建筑与cordova为android创建错误的版本代码 [英] building with cordova for android creates wrong version code

查看:245
本文介绍了建筑与cordova为android创建错误的版本代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 < 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和上传,google也告诉我版本代码是70。

platforms / android / build.gradle 下,第178行,

  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


running the command cordova build --release android produces an apk that has a version code of 70. in the config.xml file, for the widget i have set it as

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

How do I get cordova-cli to build an apk with version code 7?

Running aapt.exe l -a on the generated apk shows A: android:versionCode(0x0101021b)=(type 0x10)0x46 0x46 being 70, if I jarsigner the apk, and zipalign and upload, google also tells me the version code is 70.

解决方案

I found the answer to my problem in that under platforms/android/build.gradle, on line 178,

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

at the end is that + "0" thus turning my version code from 7 to 70. Removing the + "0" at the end and changing line 178 to the following solved this problem.

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

Running aapt.exe l -a on the generated apk now shows A: android:versionCode(0x0101021b)=(type 0x10)0x7

这篇关于建筑与cordova为android创建错误的版本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆