简体   繁体   English

更改Cordova项目android包名称

[英]Change Cordova project android package name

Does any of you know how to change the package name of an android project build with cordova? 你们中有谁知道如何更改使用cordova构建的android项目的程序包名称吗?

I've tried to change the android project name by doing: 我试图通过执行以下操作来更改android项目名称:

  1. Removing the android platform from the project by executing cordova platform remove android 通过执行cordova platform remove android从项目中cordova platform remove android

  2. I changed the <widget id> in config.xml : 我在config.xml中更改了<widget id>

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 通过执行cordova platform add android重新安装android平台

Problem is that after I did it, I got an error when executing cordova run android : 问题是我做完之后,在执行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) 摆脱此错误的唯一方法是还原到其原始程序包名称(当然还要重新安装android平台)

I tried to google a lot but I just can't seem to find any solution that works for me. 我尝试了很多Google,但是似乎找不到适合我的解决方案。 Will any of you be kind enough to enlighten me on this? 你们中的任何一个都足以启发我吗?

您可以在小部件标签中使用android-packageName

<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">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM