I have a multi module Android project and my version code is 010007 but when I build for release with proguard and minify resources on I get APK with version code 4103(visible in outputs.json file generated by proguard). This version code is still incremental meaning when my version code was 010006 in outputs.json version code was 4102.
This is my output.json:
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4103},"path":"ui-android-release.apk","properties":{"packageId":"com.example","split":"","minSdkVersion":"17"}}]
This is my dependencies.gradle which I use in project level gradle file:
ext {
// android
applicationId = "com.example"
compileSdkVersion = 26
minSdkVersion = 17
targetSdkVersion = 26
versionCode = 010007
versionName = "1.0.7"
buildToolsVersion = "27.0.3"
...
And this is build.gradle of my ui-android module(and is similar to all modules):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId rootProject.applicationId
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
configurations.all {
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
}
dependencies {
rootProject.uiAndroidDependencies.each {
add(it.configuration, it.dependency, it.options)
}
}
Leading 0 in your versioncode is creating confusion. In Groovy programming language this specifies octal (base-8) number. And indeed, 10007 in octal is equal to 4103 in decimal. You probably want to remove leading 0.