android – Change package name to existing Phonegap projects-ThrowExceptions

Exception or error:

I have an android phonegap project, and an ios phonegap project.

They were created using a given package name, but I now have to change this package name.

In Android, I think I have to change package name in manifest, plus rename/move the java file in the src folder, and change inside this java file to reflect the new package name. Then clean and build. Does this sound right?

I also noticed an option in Eclipse Android Tools >> Rename Application Package, where it asks for a package name. Would it make all necessary changes?

How would I change the bundle ID in the XCode project so the project builds ok? Just edit the Bundle identifier as explained in this ticket would do? Changing xcode package name without creating and importing to new project

Thanks for any help.

How to solve:

Yes, basically just change the android:package attribute in your manifest, and then refactor your src/ folders to follow that same package name.

As an alternative you can use the rename option in Eclipse, but it will have to modify all of the R.class imports in any of your java files that use resources. This will look a little intimidating, but should work fine.


It would be better if instead of Renaming the .java file and the class name, you just make your changes in:

  • AndroidManifest.xml
  • config.xml

Then remove android support with cordova platform remove android
And then re-add the android support cordova platform add android

This will generate the .java file again with the correct name.



As a command above, just 3 steps:

  • Remove platform cordova platform remove android

  • Edit config.xml (main folder) find & replace widget id

<widget id="com.foobar.mynewname" version="1.0.0" android-versionCode="1" xmlns="" xmlns:cdv="">
  • Add platform again cordova platform add android


The files containing the project name are:

  • AndroidManifest.xml <– package name
  • res/values/strings.xml <– visible name in list
  • build.xml
  • config.xml

Go into src/ and open the .java file.

Under the license change the package name to the new package name to whatever you desire.

Use the same package name in AndroidManifest.xml “Package”.

Attempt build and if that works then Modify the value in res/values/strings.xml.

Build again and go through each value until you are happy.


in ios all you have to do is to change the config.xml attribute

<?xml version='1.0' encoding='utf-8'?>
<widget id="org.test.area" version="1.0.0" xmlns="" xmlns:gap="">

then as kumar suggested do a cordova platform remove ios then cordova platform add ios and cordova build ios then rebuild the project in xcode!

Leave a Reply

Your email address will not be published. Required fields are marked *