Skip to content

Instantly share code, notes, and snippets.

@akperkins
Last active July 23, 2019 03:44
Show Gist options
  • Save akperkins/3ee431f8ae9fdf0304d08669dbc0130f to your computer and use it in GitHub Desktop.
Save akperkins/3ee431f8ae9fdf0304d08669dbc0130f to your computer and use it in GitHub Desktop.
Example of auto-generating the versionCode
apply plugin: 'com.android.application'
// version information
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example"
minSdkVersion 19
targetSdkVersion 26
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment