Created
June 13, 2016 16:26
-
-
Save vilmarbfilho/2726699434a3b370a2ef8255711444a4 to your computer and use it in GitHub Desktop.
Change name APK using 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
android.applicationVariants.all { variant -> | |
def appName | |
if (project.hasProperty("applicationName")) { | |
appName = applicationName | |
} else { | |
appName = parent.name | |
} | |
variant.outputs.each { output -> | |
def newApkName | |
if (output.zipAlign) { | |
newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk" | |
} else { | |
newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk" | |
} | |
output.outputFile = new File(output.outputFile.parent, newApkName) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment