Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created July 16, 2019 07:55
Show Gist options
  • Save EmmanuelGuther/34689ecf06990b7a2a559cc14b26b8af to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/34689ecf06990b7a2a559cc14b26b8af to your computer and use it in GitHub Desktop.
Function to increase the versionCode automatically
private Object increaseVersionCode() {
Properties versionProps = new Properties()
def versionPropsFile = file('version.properties')
if (versionPropsFile.exists())
versionProps.load(new FileInputStream(versionPropsFile))
def code = (versionProps['VERSION_CODE'] ?: "410").toInteger() + 1
versionProps['VERSION_CODE'] = code.toString()
versionProps.store(versionPropsFile.newWriter(), null)
return code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment