Last active
July 12, 2017 03:49
-
-
Save danielsanfr/6bd03fd981b3940863a843fe748794a9 to your computer and use it in GitHub Desktop.
Producing better named Android APKs with Gradle (Android Plugin 3.0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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