Created
September 2, 2013 16:28
-
-
Save shakalaca/6414702 to your computer and use it in GitHub Desktop.
Rename output apk file
This file contains 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 -> | |
// replace output apk name to <product>-<version>-<buildtype>-<githash>.apk | |
def versionSuffix = variant.buildType.versionNameSuffix ? variant.buildType.versionNameSuffix : "" | |
def versionName = variant.mergedFlavor.versionName + versionSuffix + "-${gitHash}"; | |
if (variant.zipAlign) { | |
def apkFinal = variant.outputFile; | |
variant.outputFile = new File(apkFinal.parentFile, apkFinal.name.replace(variant.buildType.name, versionName)); | |
} | |
def apkProcess = variant.packageApplication.outputFile; | |
variant.packageApplication.outputFile = | |
new File(apkProcess.parentFile, apkProcess.name.replace(variant.buildType.name, versionName)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment