Skip to content

Instantly share code, notes, and snippets.

@r0adkll
Created October 4, 2014 08:14
Show Gist options
  • Save r0adkll/8c5c06414d525034270b to your computer and use it in GitHub Desktop.
Save r0adkll/8c5c06414d525034270b to your computer and use it in GitHub Desktop.
Gradle Auto Versioning Logic
//auto versioning logic
def versionPropertiesFile = file('version.properties')
if (versionPropertiesFile.canRead()) {
def Properties properties = new Properties()
properties.load(new FileInputStream(versionPropertiesFile))
def build = properties['BUILD'].toInteger() + 1
properties['BUILD'] = build.toString()
properties.store(versionPropertiesFile.newWriter(), null)
defaultConfig {
applicationId "com.example.app"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "0.1.${build}"
}
}
MAJOR=0
MINOR=1
BUILD=422
PATCH=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment