-
-
Save carloscuesta/678668da906bb80bdd22c8fd690c4fc4 to your computer and use it in GitHub Desktop.
Increment versionCode task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task('incrementVersionCode') << { | |
def versionCode = Integer.parseInt(VERSION_CODE) + 1 | |
ant.propertyfile(file: "../gradle.properties") { | |
entry(key: "VERSION_CODE", value: versionCode) | |
} | |
} | |
tasks.whenTaskAdded { task -> | |
if (task.name == 'assembleRelease') { | |
task.dependsOn 'incrementVersionCode' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: July 2019
">>" is deprecated and removed and the following syntax is favored for versionCode.gradle:
apply from: './versionCode.gradle'
Replace the versionCode line under default config in your app's build.gradle with:
VERSION_CODE=1
to your gradle.properties file.