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 thro
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.
Right Click on Project >Android Tools >Rename Application Package
Go to src and right click on your main package >Refactor >Rename
Go to manifest file and change your package name .
The fastest way to do that in Android Studio 1.3:
manifest
Module Settings[F4]-> Flavors
, into Application Id
write the same name.[right-click-> new-> package]
[Right-click-> Refactor-> Move-> {Select package}-> Refactor]
P.S. If you will not follow this order you can end up changing all the java files one by one with new imports and a bunch of compile time errors, so the order is very important.
There is also another solution for users without Eclipse, simply change the package attribute in <manifest> tag in AndroidManifest.xml, by replacing the the old package name used with a new one. Note: You have to adjust the all the related import statements and related folders manually in your project than, too.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="new.package.name"
.....
</manifest>
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:
- Right-click on the package name (
src/com.android.gesture.builder
).- Select Refactor > Rename and change the name, for example to
com.android.gestureNEW.builder
.- Open the manifest file. Inside the
<manifest>
tag, change the package name tocom.android.gestureNEW.builder
.- 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).
In Android Studio 1.2.2
Say if you want to change com.example.myapp
to org.mydomain.mynewapp
You can follow the steps in each of the directories as displayed in the below screen shot. It will give you the preview option so that you can preview before making any changes.
Go to Refactor -> Rename
and give your new name. You have to do it for each of the folders, say for com, example and myapp. It will automatically update the imports so that you don't have to worry about it.
Also update the file build.gradle
which is not updated automatically.
defaultConfig {
applicationId "org.mydomain.mynewapp" //update the new package name here
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
After that it will ask for sync
do it. Then everything will be fine. I'm able to upload my APK to google store after this. Make sure you have signed your app to upload it to the store.