0

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.

Niraj
  • 107
  • 2
  • 14

3 Answers3

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

The answer is correct. You just need to copy each and every data from the ui package to the battery package and then delete the ui package.

Community
  • 1
  • 1
Anmol317
  • 1,356
  • 1
  • 14
  • 31
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