为什么科尔多瓦/ PhoneGap的追加8到Android版本code? [英] Why does Cordova/Phonegap append 8 to my Android Version Code?
问题描述
我目前工作的一个科尔多瓦项目,并有这样8被神秘地附在我的项目的版本code中的问题。例如:我的原始版本code是100,新版本code为1008
I am currently working on a Cordova project and had the problem that 8 was appended mysteriously to the versionCode of my project. For example: My original Version code was 100, the new Version code is 1008
我通过我的整个构建管道跟踪的问题,发现在摇篮负责code编译脚本。
I tracked the problem through my whole build pipeline and found the responsible code in the Gradle Build script.
if (Boolean.valueOf(cdvBuildMultipleApks)) {
productFlavors {
armv7 {
versionCode cdvVersionCode ?: defaultConfig.versionCode + 2
ndk {
abiFilters "armeabi-v7a", ""
}
}
x86 {
versionCode cdvVersionCode ?: defaultConfig.versionCode + 4
ndk {
abiFilters "x86", ""
}
}
all {
ndk {
abiFilters "all", ""
}
}
}
} else if (!cdvVersionCode) {
def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
// Vary versionCode by the two most common API levels:
// 14 is ICS, which is the lowest API level for many apps.
// 20 is Lollipop, which is the lowest API level for the updatable system webview.
if (minSdkVersion >= 20) {
defaultConfig.versionCode += 9
} else if (minSdkVersion >= 14) {
defaultConfig.versionCode += 8
}
}
我不知道为什么科尔多瓦认为这是正确的改变我的版本code,另外,我不知道这行为是正确的......不应该把它添加数量,而不是追加了吗?
I am not sure why cordova thinks it is correct to change my version code, and additionally, I am not sure if this behaviour is correct ... shouldnt it add the number and not append it?
我可以只删除相应的部分中的的build.gradle或者是有这种行为背后隐藏的一些感?
Can I just remove the corresponding section in the build.gradle or is there some hidden sense behind this behaviour?
推荐答案
O.K。看起来这是在科尔多瓦第5版和一个尚未解决的主要错误。 这里是链接到车票。
O.K. seems like this is a major unresolved bug in Cordova Version 5 and up. Here is the link to the ticket.
从我的build.gradle删除违规code时,我没有问题。
I had no problem when removing the offending code from my build.gradle
这篇关于为什么科尔多瓦/ PhoneGap的追加8到Android版本code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!