How To Change Package Name In Android Studio

How To Change Package Name In Android Studio

Want to change the package name of your existing app or any android projects that you brought/downloaded recently? but getting errors? renaming folder or manifest or gradle will bring errors and thus you won’t be able to compile it. So, it’s really important to follow the correct steps to rename the package name of your android app.

Generally, a package is a directory where the source codes are stored. As an example: com.company.app . A developer may change the package name for different reasons such as he download or purchased a project source code from the web and need to rename it according to his app’s details.

So, if you are trying to change your old package name to a new name like: com.company.app to com.zealtyro.app or something, then this article is for you! Let’s jump inside…

Changing/Renaming The Package Name In Android Studio

First of all, open your project in android studio. Then follow the steps below:

  1. Click on the settings icon on the top right corner in “project” tab
  2. Uncheck the “compact middle packages
  3. Now you will see that the folder named with the package name has divided into 3 folders.
  4. Select the folder named with what you want to change and right click on it. Then go to “Refactor“, then click on “Rename“.
  5. A popup dialogue will appear, click “Rename Package
  6. In the input box type the name you prefer to have and click “refactor
  7. If your android project have so many activities then it may take few minutes and an extra dialogue may appear on the bottom. just click “refactor” button if it appears.
  8. Now you will see the folder name got change. If not then don’t worry, just close the project and reopen it.
  9. Now we need to open the “build.gradle (Module)“, you can find it in the “Gradle Scripts” section. Then change the “application id” to the new package name if it not got updated yet. Then click “Sync Now“.
  10. Next, open the “AndroidManifest.xml” and change the package name to the new one if it’s not got updated yet.
  11. Done!

Congratulations!

You have successfully change the package name of your android app in android studio!

Thanks For Allowing Us To Help You 🙂
If you are confused or want to know something, then let us know in the comment box, we will reach you as soon as possible. Don’t Forget To Subscribe our Newsletter, YouTube Channel, and Like Our Facebook Page To Keep Updated With Awesome Things. Follow us on Twitter to stay updated with the latest news & changes.

Did you like it?