Skip to content

Instantly share code, notes, and snippets.

@dario61081
Created August 18, 2017 12:47
Show Gist options
  • Select an option

  • Save dario61081/a22133887d9bcfcaa4909f5713b2fec0 to your computer and use it in GitHub Desktop.

Select an option

Save dario61081/a22133887d9bcfcaa4909f5713b2fec0 to your computer and use it in GitHub Desktop.
Custom apk name
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
applicationVariants.all { variant ->
variant.outputs.each { output ->
project.ext { appName = 'whpicking' }
def formattedDate = "-" + variant.versionName + "_" + variant.versionCode + "-" + new Date().format('yyyyMMddHHmmss')
def newName = output.outputFile.name
newName = newName.replace("app-", "$project.ext.appName-")
newName = newName.replace("-release", "-release" + formattedDate)
output.outputFile = new File(output.outputFile.parent, newName)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment