繁体   English   中英

使用cordova for android构建错误的版本代码

[英]building with cordova for android creates wrong version code

运行命令cordova build --release android在config.xml文件中生成一个版本代码为70的apk,对于我将其设置为的小部件

<widget id="com.example.myapp"
        android-versionCode="7"
        version="0.9.1"
        >

如何让cordova-cli构建一个版本号为7的apk?

在生成的apk上运行aapt.exe l -a显示A: android:versionCode(0x0101021b)=(type 0x10)0x46 0x46是70,如果我jarsigner的apk,并且zipalign和上传,谷歌也告诉我版本代码是70 。

我在第178行的platforms/android/build.gradle下找到了我的问题的答案,

versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode") + "0")

最后是+ "0"从而将我的版本代码从7变为70.删除末尾的+ "0"并将行178更改为以下解决了这个问题。

versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode"))

在生成的apk上运行aapt.exe l -a现在显示A: android:versionCode(0x0101021b)=(type 0x10)0x7

我有同样的问题,我正在使用Cordova 4.3.0。 AndroidManifest.xml中的versionCode为“1”,而.apk中的versionCode为“12”。 如果你在引用的行之后查看代码块,构建多个版本将为arm7添加“2”,为x86添加“4”。 我有点明白为什么这样做了,但在我看来,最好让开发人员确定他们想要的versionCode。

暂无
暂无

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

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