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
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
}
}
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?
Can I just remove the corresponding section in the build.gradle or is there some hidden sense behind this behaviour?