Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Cordova project android package name

Does any of you know how to change the package name of an android project build with cordova?

I've tried to change the android project name by doing:

  1. Removing the android platform from the project by executing cordova platform remove android

  2. I changed the <widget id> in config.xml:

From

<widget id="com.oldName.oldName" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

to

<widget id="com.newName.newName" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  1. Reinstall android platform by doing cordova platform add android

 

Problem is that after I did it, I got an error when executing cordova run android:

(node:xxxxx) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'manifest' of undefined

The only way to get rid of this error is to revert back to its original package name (and of course to re-install android platform)

I tried to google a lot but I just can't seem to find any solution that works for me. Will any of you be kind enough to enlighten me on this?

like image 995
blue2609 Avatar asked Dec 29 '17 23:12

blue2609


People also ask

How do I change my app name in cordova?

In cordova project> properties> WMAppManifest. xml file you can change you app's name and icon as well. Save this answer.

How do I change package name in ionic app?

Change the id to whatever you wish your package to be and it will work for the entire project, Android and iOS. However, if you've already submitted to the app store with a package name, you cannot change the package name at this point. Not unless you want to submit a new project.

Does cordova need Android studio?

Cordova-Android projects can be opened in Android Studio. This can be useful if you wish to use Android Studio's built in Android debugging and profiling tools or if you are developing Android plugins. Note: When opening your project in Android Studio, it is recommended to NOT edit the code within the IDE.


1 Answers

You can use android-packageName inside the widget tag

<widget id="com.oldName.oldName" android-packageName="com.newName.newName" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
like image 93
jcesarmobile Avatar answered Oct 06 '22 17:10

jcesarmobile