Trick changes package name super fast for Android project.

Tram Ho

If you are struggling to change the package name easily, this is the article for you.

Or if not then it will help you in the future.

Android Studio has excellent refactor capabilities just by right-clicking on the file or package => Select refactor => rename => done.

However, this does not work if you want to change the package name from com.android.example => brand.com.product

The simple method consists of 3 steps:

  1. Copy package name => Press Ctrl + shift + R => Replace all

  1. Right-click on the package root (here com) => select Show in explorer => Rename to “brand” => Go inside and rename “android” => “com”

  1. Reopen Android Studio => Build => Clean project Then go to File => Invalidate Cahes / Restart => Select invalidate and restart.

    Done 😄

Share the news now

Source : Viblo