How to Change Package Name in Android Studio App

Advertisement

So many beginners of android studio have doubt “How to change package name in android studio app“?

  1. You can change it easily from Android Studio. Here are the steps: You can change it easily from Android Studio.
  2. Here are the steps:In the Android pane, click on the little gear icon.Uncheck/Deselect the Compact Empty Middle Packages option.
  3. Your package directory will now be broken up in individual directories.
  4. Individually select each directory you want to rename, and: Right-click itSelect RefactorClick on RenameIn the Pop-up dialog.Click on Rename Package instead of Rename Directory Enter the new name and hit RefactorAllow a minute to let Android Studio update all changes.
  5. Now open your build.gradle (Usually ‘app’ or ‘mobile’).
  6. Update the applicationId to your Package Name and Sync Gradle, if it hasn’t already been updated automatically.

Note: When renaming com in Android Studio, it might give a warning. In such case, selectRename All.

It is very simple to change package name in android studio. I will show your few steps to change package name simply. Follow these steps to change package name android studio apk.

Advertisement

Step1

In your Project pane, click on the little gear icon

step2

Uncheck the Compact Empty Middle Packages option

Step3

Your package directory will now be broken up into individual directories

Step4

Individually select each directory you want to rename, and:

  • Right-click it
  • Select Refactor
  • Click on Rename
  • In the pop-up dialog, click on Rename Package instead of Rename Directory
  • Enter the new name and hit Refactor
  • Click Do Refactor in the bottom
  • Allow a minute to let Android Studio update all changes
  • Note: When renaming com in Android Studio, it might give a warning. In such case, select Rename All

Step5

Now open your Gradle Build File (build.gradle – Usually app or mobile). Update the applicationId in the defaultConfig to your new Package Name and Sync Gradle, if it hasn’t already been updated automatically:

Step6

You may need to change the package= attribute in your manifest

Step7

Clean and Rebuild.

Step8

Congratulations! Anyway, Android Studio needs to make this process a little simpler.

For more doubts: Click Here

Advertisement

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top