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:
- Click on the settings icon on the top right corner in “project” tab
- Uncheck the “compact middle packages“
- Now you will see that the folder named with the package name has divided into 3 folders.
- Select the folder named with what you want to change and right click on it. Then go to “Refactor“, then click on “Rename“.
- A popup dialogue will appear, click “Rename Package“
- In the input box type the name you prefer to have and click “refactor“
- 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.
- Now you will see the folder name got change. If not then don’t worry, just close the project and reopen it.
- 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“.
- Next, open the “AndroidManifest.xml” and change the package name to the new one if it’s not got updated yet.
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.