Rename Package Name In Android Studio

A Developer 😀
2 min readAug 8, 2020

--

Preface

There are certain situations and legal requirements when there is a requirement to change the package name of the App in Android Studio. But changing the package name manually is a tedious and time-consuming task, below are the steps which can change package name in a blink of an eye.

Importance of Package Name

The Android build tools use the package attribute for two things:

  1. It applies this name as the namespace for your app’s generated R.java class
  2. It uses package name to resolve any relative class names that are declared in the manifest file

Rename App Package Name

Step 1: First of all open the android project in Android Studio. The project browser visualizes the project as Android View.

Step 2: Open the settings dialog from the project browser, and de-select “Compact Empty Middle Package” option. After de-selection package folder is broken into parts

Step 3: Select the package folder and refactor(rename) the existing package name. A warning dialog will be shown but go ahead and click rename package. After that enter your new domain name for the package name

Step 4: At the bottom of the Android Studio “Find Refactoring Preview” drawer opens up. Just click on “Do Refactor “

Step 5: The above action has changed the package domain name of the app. Next, change the domain extension and App folder name according to the new requirements.

Step 6: Finally open build Gradle file (Module: App), change the application id, and click sync now.

Conclusion

The package name is successfully changed in Android Studio.

Thanks :)

Happy Coding :)

--

--

A Developer 😀
A Developer 😀

Written by A Developer 😀

Reader | Traveller | Freelancer | Android & Fullstack Developer | Open-Source Enthusiast | Loves Automation

Responses (1)