Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rename the android package name? [duplicate]

You can do this:

  1. Change the package name manually in the manifest file.
  2. Click on your R.java class and the press F6 (Refactor->Move...). It will allow you to move the class to another package, and all references to that class will be updated.

The best way to solve this is going to the AndroidManifest.xml: package="com.foocomp.fooapp:

  • Set the cursor on "foocomp"
  • Press Shift+F6
  • Rename Package to whatever you want
  • Repeat for "fooapp".

Works for me.

Also, replace in Path in Whole Project as it didn't change everything. Then Clean, Rebuild and it works --> In Android Studio / IntelliJ you should unmark "Compact Empty Middle Packages"


Eclipse: Right click on the project > Android tools > Rename application package.

As simple as that...

enter image description here

In Android Studio: open the build.gradle file > rename the applicationId under defaultConfig > synchronize


  1. Goto your AndroidManifest.xml.
  2. place your cursor in the package name like shown below don't select it just place it.

Just place your cursor on it

  1. Then press shift+F6 you will get a popup window as shown below select Rename package.

enter image description here

  1. Enter your new name and select Refactor. (Note since my cursor is on "something" only something is renamed.)

That's it done.


I found another solution for renaming a package in the entire project:

  1. Open a file in the package.
  2. IntelliJ displays the breadcrumbs of the file, above the opened file.
  3. On the package you want renamed: Right click > Refactor > Rename.

This renames the package/directory throughout the entire project.


Deselect Hide Empty Middle Packages in Project Explorer Windows settings menu than you will be able to refactor each directory