Skip to content

Instantly share code, notes, and snippets.

@florinmuscalu
Created February 4, 2021 21:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
android {
...
def versionFile = file('version.properties')
Properties prop = new Properties()
if (versionFile.canRead()) {
prop.load(new FileInputStream(versionFile))
}
else {
prop['VERSION_CODE']='0'
}
def code = prop['VERSION_CODE'].toInteger() + 1
prop['VERSION_CODE']=code.toString()
prop.store(versionFile.newWriter(), null)
defaultConfig {
...
versionCode code
versionName "1.0"
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment