how to change android studio project name

Renaming Your Android Studio Project: A Simple Guide

By William Walker
AD

Need to rename an Android Studio project? Don't let the fear of breaking code or losing project pointers deter you. With the right steps, you can easily change your Android Studio project name without any loss of functionality. So, let's dive into the process and make sure your project's name accurately reflects its content.

Renaming an Android Studio project, though straightforward, involves a few steps that extend beyond changing the name in the project's directory. Let's break these down into two main topics: updating the project's build tools and renaming the project module.

Updating Build Tools

When you change your project's name, you need to update the build tools as well. This includes Gradle, as it plays a pivotal role in managing dependencies and builds. Let's look at updating Gradle and other build tools.

AD
Android Studio Create New Project Step By Step | How To Create Project in Android Studio
Android Studio Create New Project Step By Step | How To Create Project in Android Studio
How to Create an Android App With Android Studio
How to Create an Android App With Android Studio
Beginner’s Guide to Android Studio and Kotlin Setup on Ubuntu 24.04
Beginner’s Guide to Android Studio and Kotlin Setup on Ubuntu 24.04

First, ensure that Android Studio is using the latest version of Gradle. You can do this in the Settings or Preferences menu. Once updated, navigate to your project's build.gradle file and update the "android" namespace according to your new project name.

Gradle: "android" Namespace

Find the "android" namespace in the dependencies block. If your project uses the AndroidX library, it should resemble the following:

How to Create Android Assets Folder in Android Studio
How to Create Android Assets Folder in Android Studio
Hello World in Android development: Your first ever (really easy) app project
Hello World in Android development: Your first ever (really easy) app project
I will do android projects and tasks in android studio
I will do android projects and tasks in android studio

dependencies {
    implementation platform('androidx.buildtools:3.4.1')
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
}

AD

Ensure the build tools version matches your current project and update the "android" namespace accordingly, like so:

screenshot
screenshot
Android studio — Tips & Tricks
Android studio — Tips & Tricks
50 Android Studio Tips, Tricks & Resources you should be familiar with, as an Android Developer
50 Android Studio Tips, Tricks & Resources you should be familiar with, as an Android Developer
Your Roadmap to Becoming an Android Developer
Your Roadmap to Becoming an Android Developer
android studio
android studio
Change The App Icon in Android Studio
Change The App Icon in Android Studio

android {
    namespace 'com.example.newprojectname'
    compileSdkVersion 30
    buildToolsVersion "30.0.2"
}

AD

Update Other Build Configurations

In addition to Gradle, you'll also need to update other build configurations. This includes the applicationId, version, and other key-value pairs in your project's build.gradle file and the defaultConfig block in your app-level build.gradle file. Make sure these match your new project namespace.

Memes
Memes
Modern KMP project structure
Modern KMP project structure
Using Scratch Files in Android Studio
Using Scratch Files in Android Studio

The applicationId should align with your new project name, like so:

AD
applicationId 'com.example.newprojectname.app'

Renaming the Project Module

Renaming the project module goes hand in hand with updating the build tools. This is where you'll physically change the project's name inside Android Studio. Let's look at how to do this:

In the Project window, right-click on your project and select "Refactor" > "Rename..." from the context menu. A dialog box will open where you can enter your new project name. Once complete, click "Refactor" to apply the changes.

Update App Module

After renaming the project module, you'll need to update the app module's name as well. In the Project window, right-click on the app module and select "Refactor" > "Rename...". Ensure the package names match your new project name to avoid any unnecessary errors.

Don't forget to update any additional modules or external libraries that depend on your app module.

refresh Gradle Files

Once you've updated the project and app module names, Android Studio might not reflect these changes immediately. You can refresh the Gradle files by simply rebuilding your project. To do this, go to Build > Make Project or press Ctrl + F9 (Windows/Linux) or Cmd + F9 (Mac). This should sync your project's changes with the build tools and update the Gradle files.

Now that you've successfully changed your Android Studio project name, it's time to check if everything is working as expected. Run your project on an emulator or physical device, and verify that all functionalities are intact.

In the ever-evolving world of Android development, renaming projects isn't just about aesthetics but also about keeping your project organized and easy to navigate. So, whenever you need to rename a project, don't hesitate. With the right steps, it's a breeze!

AD