Skip to content

Instantly share code, notes, and snippets.

@danielsanfr
Last active July 12, 2017 03:49
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/6bd03fd981b3940863a843fe748794a9 to your computer and use it in GitHub Desktop.
Save danielsanfr/6bd03fd981b3940863a843fe748794a9 to your computer and use it in GitHub Desktop.
Producing better named Android APKs with Gradle (Android Plugin 3.0)
// http://www.jayway.com/2015/03/13/producing-better-named-android-apks-with-gradle/
// https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property
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.all { output ->
def variantVersionName = variant.versionName.replace("debug", "")
outputFileName = "${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