简体   繁体   English

Cordova Android构建版本与Gradle的代码

[英]Cordova Android build versionCode with Gradle

I have an existing Cordova app that I am updating. 我有一个要更新的现有Cordova应用程序。 The Cordova versions are: Cordova 6.3.0 and cordova-android 5.2.2 Google Play has started saying: Cordova版本为: Cordova 6.3.0cordova-android 5.2.2 Google Play已经开始说:

"Upload failed. Your APK's version code needs to be higher than 2016032518" “上传失败。您的APK的版本代码必须高于2016032518”

(2016032518 is the currently released version). (2016032518是当前发布的版本)。

My config.xml contains this: 我的config.xml包含以下内容:

<widget android-versionCode="201608291" ios-CFBundleVersion="201608291" version="1.5.0"

I am building with cordova build android --release 我正在用cordova build android --release

The AndroidManifest (in platforms/android/AndroidManifest.xml) contains the correct versionCode: AndroidManifest(在platform / android / AndroidManifest.xml中)包含正确的versionCode:

<manifest android:hardwareAccelerated="true" android:versionCode="201608291" android:versionName="1.5.0"

I have tried: 我努力了:

  1. Adding versionCode 201608291 inside the defaultConfig {} block in build.gradle versionCode 201608291defaultConfig {}块内添加versionCode 201608291 201608291

  2. Specifying the versionCode in the the build command like cordova build android --release --versionCode=201608291 在诸如cordova build android --release --versionCode=201608291类的build命令中指定versionCode

Given that the file platforms/android/AndroidManifest.xml contains the correct versionCode it seems that the built APK file does NOT have the right version. 鉴于文件platforms/android/AndroidManifest.xml包含正确的versionCode,似乎内置的APK文件没有正确的版本。

How can I solve this? 我该如何解决?

How can I even see what version the compiled APK has? 我什至怎么看已编译的APK的版本?

Pay attention to the numbers: 注意数字:

android:versionCode="201608291"

201608291 has 1 digit less than 2016032518 201608291位数比2016032518少1位

VersionCodes are comparesd as integer values, so 201608291 is really lower than 2016032518 将VersionCodes作为整数进行比较,因此201608291确实低于2016032518

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

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