Skip to content

Instantly share code, notes, and snippets.

@danielsanfr
Created November 23, 2016 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielsanfr/208c44f16ad5e8d1f4721cd247188542 to your computer and use it in GitHub Desktop.
Save danielsanfr/208c44f16ad5e8d1f4721cd247188542 to your computer and use it in GitHub Desktop.
Producing better named Android APKs with Gradle
// http://www.jayway.com/2015/03/13/producing-better-named-android-apks-with-gradle/
android.applicationVariants.all { variant ->
def appName
// Check if an applicationName property is supplied; if not use the name of the parent project.
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}
variant.outputs.each { output ->
def variantVersionName = variant.versionName.replace("debug", "")
output.outputFile = new File(output.outputFile.parent, "${appName}-${output.baseName}-${variantVersionName}-${variant.versionCode}.apk")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment