Created
June 16, 2017 07:25
-
-
Save christianascone/5e4c48de77b358aa965825faf2f3c8eb to your computer and use it in GitHub Desktop.
Gradle instruction for renaming apk with app version
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
applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
def outputFile = output.outputFile | |
if (outputFile != null && outputFile.name.endsWith('.apk')) { | |
def version = defaultConfig.versionName | |
//version = version.replaceAll('\\.', '_') | |
def fileName = "appName_v" + version + ".apk" | |
if(variant.name.equals("variantName")){ | |
fileName = "appName_variant_v" + version + ".apk" | |
} | |
output.outputFile = new File(outputFile.parent, fileName) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment