I want to have a different versionCode
for debug
build type rather than the one in release
build type. This used to work by using the configuration from below in Gradle Android plugin v2.3.2 (Gradle v3.3), but doesn't have any effect now in v3.0.0-alpha5 (Gradle v4.1-milestone-1). Any ideas as to what changed in the newest Gradle plugin that makes it ignore the variant.mergedFlavor.versionCode
attribute?
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-" + buildTime()
android.applicationVariants.all { variant ->
if (variant.buildType.name != buildTypes.debug.name) return
variant.outputs.all {
outputFileName = "${archivesBaseName}-${variant.name}-v${variant.versionName}-signed.apk"
variant.mergedFlavor.versionCode = Integer.parseInt(buildTimeSmall())
}
}
}
}
As a workaround before the 3.0 release, if anybody is looking for a solution, you can use:
output.setVersionCodeOverride(Integer.parseInt(buildTimeSmall()))
Thanks to Jerome, reference: https://issuetracker.google.com/issues/63785806#comment6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With