# Change Application Package Name

To change the package name, follow the following steps

* In your **Project pane**, click on the little gear icon
* Uncheck the Compact Empty Middle Packages option





<figure><img src="https://1665215671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkG8iZctiwXA991xthixp%2Fuploads%2FqOAZ4qd8d0G6O95rqMJo%2Fempty_compact.png?alt=media&#x26;token=33523ab5-c2cd-40cd-ba5e-4a5cc7ee487a" alt=""><figcaption></figcaption></figure>

* Your package directory will now be broken up into individual directories
* 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
  * 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**

<figure><img src="https://1665215671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkG8iZctiwXA991xthixp%2Fuploads%2FfXjn7mqlzqwXifquJzpe%2Frefractor.png?alt=media&#x26;token=ff10804f-c75b-476e-adea-7bfb7b2ab7de" alt=""><figcaption></figcaption></figure>

* 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:
*

    <figure><img src="https://1665215671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkG8iZctiwXA991xthixp%2Fuploads%2FcHv8U44kKya8IhJPxSbK%2Fgradle.png?alt=media&#x26;token=7f70f942-825e-4a97-abd9-847dcee913c2" alt=""><figcaption></figcaption></figure>
* You may need to change the package= attribute in your manifest file.
* Clean and Rebuild. Done.

<figure><img src="https://1665215671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkG8iZctiwXA991xthixp%2Fuploads%2FZBISY8u8rTOUKwZGNTcK%2Fclean.png?alt=media&#x26;token=53f8c31e-65f0-43f0-9555-7554b875dca9" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Important : your **applicationId or package name** must same with your package name that you’ve create on firebase console when you generate google-services.json
{% endhint %}
