Refactor Package name in Android studio

For Example, if you want to change package from com.example.test.myapplication to com.example.animation.myapplication  .

Do below steps:

  1. Select below option from project pane.

    Capture1
    fig 1
  2. Toggle Compact Empty Middle Packages/ Hide Empty Middle Packages as below
Untitled1
fig 2

3. When Toggle compact package name to Hide Empty packages package name will broken up in individual name like below.

Capture2
fig 3

4. Now Click on individual directories and select Refactor using right click on directory name which you want to change or use Shift + F6 then select rename package.

Capture3
Fig 4

5. Now Rename your package

Capture4
fig 5

6. Select Refactor and do refactor from Find refactoring Preview  in bottom of Android studio.

Capture5

Now your package will rename in all places no need to worry!

Thanks !!

Advertisements