Skip to content

Instantly share code, notes, and snippets.

@ShreyashPromact
Created February 20, 2017 10:47
Show Gist options
  • Save ShreyashPromact/09356d7ae91eb917e5c89ea7ad534f70 to your computer and use it in GitHub Desktop.
Save ShreyashPromact/09356d7ae91eb917e5c89ea7ad534f70 to your computer and use it in GitHub Desktop.
#Below is the example for how to make gradle to have apk file name with version.
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
... SOMETHING LIKE RELEASE SIGNING CONFIG ...
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
project.archivesBaseName = "LMS"; // HERE YOU NEED TO PROVIDE PROJECT NAME (BASE NAME)
signingConfigs {
release {
keyAlias 'ALIAS_NAME'
keyPassword 'ALIAS_PASWORD'
storeFile file('C:/../../.android/KEYSTORE_NAME.keystore')
storePassword 'KEYSTORE_PASSWORD'
}
}
defaultConfig {
...
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// HERE YOU NEED TO DEFINE THE APK FILE NAME AS LIKE BELOW
applicationVariants.all { variant ->
variant.outputs.each{ output ->
output.outputFile = new File(output.outputFile.parent,output.outputFile.name.replace(".apk","_v" + defaultConfig.versionName + ".apk" ))
}
}
}
}
productFlavors {
staging {
...
}
live {
...
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment