Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change package name of an Android Application

Tags:

java

android

My keystore is corrupt, therefore the Android Market is requiring me to rename the app and resubmit it. However, whenever I go to edit the package names in Manifest and throughout the files, it gives me tons of errors.

What's the proper way to change the application name?

like image 730
Allen Gingrich Avatar asked Oct 26 '10 15:10

Allen Gingrich


People also ask

Can we change package name of APK?

I would recommend unpacking the apk with apktool, and then edit the apktool. yml, setting renameManifestPackage to the new package name. Then when you rebuild the apk with apktool, it should use aapt's --rename-manifest-package functionality to change the package name.

Can you change a package name?

In the Pop-up dialog, click on Rename Package instead of Rename Directory. Enter the new name and hit Refactor. Click Do Refactor in the bottom. Allow a minute to let Android Studio update all changes.

Can we change package name in Android Studio?

Step by Step Implementation Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image. Step 4: Now right-click on the first package name (com) and Refactor > Rename.

Can I change package name of published app?

From Dianne Hackborn: Things That Cannot Change: The most obvious and visible of these is the “manifest package name,” the unique name you give to your application in its AndroidManifest.


2 Answers

There is a way to change the package name easily in Eclipse. Right click on your project, scroll down to Android Tools, and then click on Rename Application Package.

like image 152
Marc Bernstein Avatar answered Sep 23 '22 16:09

Marc Bernstein


If you're using Eclipse, you could try these instructions from Android's developer site. They're specifically for the GestureBuilder sample but should apply to any application as far as I can tell:

[H]ere's how you could do this in Eclipse:

  1. Right-click on the package name (src/com.android.gesture.builder).
  2. Select Refactor > Rename and change the name, for example to com.android.gestureNEW.builder.
  3. Open the manifest file. Inside the <manifest> tag, change the package name to com.android.gestureNEW.builder.
  4. Open each of the two Activity files and do Ctrl-Shift-O to add missing import packages, then save each file. Run the GestureBuilder application on the emulator.

Also, be sure you remembered to rename the package itself along with the references to it in the files. In Eclipse you can see the name of the package in the file explorer window/tree view on the left hand side. In my experience, Eclipse can sometimes be a little finnicky and unreliable with this (leaving behind stray references to the old package name, for example).

like image 42
eldarerathis Avatar answered Sep 21 '22 16:09

eldarerathis