I have a package name let's say "com.example.boost.ui" which i have to replace with "com.example.boostback". I tried a lot but not getting success.How do i do that please tell me.
Asked
Active
Viewed 158 times
0
-
1Check this: http://stackoverflow.com/questions/16804093/android-studio-rename-package – twist3r May 16 '17 at 07:37
-
1Possible duplicate of [Android Studio Rename Package](http://stackoverflow.com/questions/16804093/android-studio-rename-package) – Atef Hares May 16 '17 at 07:37
-
Right click on Your package name and click Refractor and then change package name whatever you want. – Vishal Senjaliya May 16 '17 at 07:39
3 Answers
0
In your Project pane, click on the little gear icon ( Gears icon )
Uncheck / De-select the "Compact Empty Middle Packages" option
Your package directory will now be broken up in 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
Enter the new name and hit Refactor
Done

Anuraag
- 218
- 3
- 9
-
but my package name is "com.example.battery.ui" which i have replace with "com.example.battery: not to include "ui" along with – Niraj May 16 '17 at 07:42
-
Just follow above process and when you click on "Compact Empty Middle Packages" then it will display the seperate folder then delete that "ui" part and make sure also copy and past that package in gradle file also – Vishal Senjaliya May 16 '17 at 07:44
-
hey i have tried to delete "ui" part but it also delete all the activity because activity package name are as: com.example.battery.ui.MainActivity" – Niraj May 16 '17 at 08:23
0
Go to your manifest file and you will see there
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.boost.ui"
...
than select com.example.boost.ui and right click than go to refractor go to rename and select "rename package" option and it will be done.

Krishna Meena
- 5,693
- 5
- 32
- 44