Created
November 23, 2016 05:07
-
-
Save danielsanfr/208c44f16ad5e8d1f4721cd247188542 to your computer and use it in GitHub Desktop.
Producing better named Android APKs with Gradle
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/ | |
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