I migrated to Android studio 3 and using gradle plugin v3.0.0-beta6. I would like to rewrite versionName/vesionCode of output .apk files. I used following code for gradle plugin 2.x in the build.gradle of my Android app module
applicationVariants.all { variant ->
def flavor = variant.mergedFlavor
flavor.versionName="${VERSION_NAME}"
if (variant.buildType.isDebuggable()) {
flavor.versionCode=9999
} else {
flavor.versionCode=Integer.parseInt(gitCommitCount)
}
}
It doesn't work on gradle plugin v3.0.0-beta6. For versionCode, I successfully rewrite it with the solution in this Gradle 3.0.0 alpha variant output issue