Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change android package name for phonegap project

I have come to be responsible for adding push notification capabilities to a phonegap project. Things in iOS are working smoothly but Android is causing some trouble. The problem seems to be that the application package/bundle name is com.phonegap.helloworld. Urbanairship does not like a "duplicate package name", which was easily changed in xcode but not so easily changed in the android side.

I attempted the accepted answer from this question: Change package name to existing Phonegap projects that is, I changed the the 'package' field in the platforms/android/AndroidManifest.xml and then refactored the directory structure to reflect this new package. When I built the android app, however, the old directory that I'd mv'd to reflect the package name change reappeared. The AndroidManifest.xml file had also been altered so that the 'package' field was back to com.phonegap.helloworld.

So I am baffled - how do I change the package name?

like image 550
John Avatar asked Dec 01 '22 19:12

John


1 Answers

You shouldn't edit the files under platforms/ this is where phonegap creates the specific device versions based on the www directory and will overwrite them whenever you run a new build.

To edit the package name, open the config.xml file in the www directory. The package name is the value for 'id' in the 'widget' tag:

<widget
    id="PACKAGE NAME"
    version="1.0.0"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:gap="http://phonegap.com/ns/1.0"
>

Here's a link to another example.

like image 186
Brian Avatar answered Dec 06 '22 10:12

Brian