How to rename an Android Studio Project

Oscar de la Hera Gomez
A flower that represents Android Studio with the text “Rename Project” beneath it.

A step by step guide on renaming an Android Studio project. Open Source Kotlin Android project included.

We recommend that you clone our Open Source Kotlin Starter Project, checking out the main branch and carrying out the steps below. The changes can be found on the tutorial/basics/rename-project branch.

git clone git@github.com:delasign/kotlin-android-starter-project.git

Please note that this tutorial renames the project from "Sample Project / samplestarterproject" to "A Sample Project / asamplestarterproject".

Step One: Rename the App Name

A screenshot of Android Studio showing you how to change the name of the app. Highlighted is the strings.xml file under values folder within the res folder. Highlighted on the file is the "app_name" string. Change this string to change the name of the app.

In Android Studio, under res > values > strings.xml change the app_name string to the name that you wish for your app to display on the Android device.

Step Two: Rename the Root Project Name

A screenshot of Android Studio showing you how to rename the root project name. This is found in the settings.gradle.kts file, within the Gradle Scripts.

Under Gradle Scripts > settings.gradle.kts rename the rootProject.name to the name of your project.

Step Three: Rename the Namespace and AppId

A screenshot of Android Studio showing you how to rename the App Id and Name Space. We have sampled this by creating a "bundleId" value, which is found within the build.gradle.kts file. This has been done to keep things consistent as these are often the same.

Under Gradle Scripts > build.gradle.kts (Module :app) rename the bundleId to the namespace / applicationId of your project.

Please note that we have created a BundleId value so that it is consistent across the namespace and appId.

Step Four: Refactor Project Folders

A screenshot of Android Studio showing you that the project folders have been refactored. Follow the steps below to learn how to do this.

Follow the steps below to refactor the project folders to work with the new namespace and appId.

A | Rename Folders

A screenshot of Android Studio showing you how to how to refactor the project names. Please select the top folder within the Java folder and refactor it.

Under app > java right click the first folder (com.delasign.samplestarterproject) and refactor it to the same bundleId that you used in Step Three.

B | Select all directories

In the pop up that appears, select the "All Directories" button to make sure it applies it to the relevant folders.

In the pop up that appears, select All Directories.

C | Refactor

In the top input, enter the bundleId that you used in Step Three. Once you're done, click the refactor button on the bottom right.

In the pop up that appears, refactor the folders to the BundleId that you used in Step Three.

Step Five: Sync Gradle Scripts

A screenshot of Android Studio show you how to sync the gradle files. Press File in the menu bar and in the options that appear select "Sync Project with Gradle Files."

Sync your gradle files.

Step Six: Clean & Rebuild

A screenshot of Android Studio show you how to clean your project. Highlighted is the Build menu and the Rebuild Project option.

To make sure that the changes have gone through, clean and rebuild your project.

Step Seven: Run

A screenshot of the app after the project has been renamed.

Run the project on a device or simulator to make sure that everything worked out.

OPTIONAL: Update the Proguard-rules.pro file

A screenshot of Android Studio with the proguard-rule.pro file open. Highlighted is a demonstration of how we stop the obfuscation of our language directory to ensure that the JSON data class works after being released.

If your project has removed specific files or directories from being obfuscated, you must update the bundleId of any paths within the proguard-rules.pro file.

OPTIONAL: Update the App Bundle Id Constant

A screenshot of Android Studio highlighting the Constant.kt file and the kAppBundleId. Change this to make sure that the Notifications (Intents) register to your app.

If you are using our Open Source project or methodology, update the kAppBundleId in the Constants.kt file to make sure that the Notifications (Intents) are sent to the right package.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details