Created
June 25, 2015 08:08
-
-
Save mbelsky/3dd52ca6b074eb9bc3a7 to your computer and use it in GitHub Desktop.
Snippet for adding current version value in android apk release file name
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
/** | |
* Define 'APP_MODULE_NAME' and 'APK_NAME' vars in gradle.properties file. | |
*/ | |
android { | |
applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
def outputFile = output.outputFile | |
if (outputFile != null && outputFile.name.endsWith('.apk')) { | |
def fileName = outputFile.name.replace('.apk', "-${versionName}.apk") | |
fileName = fileName.replace(APP_MODULE_NAME, APK_NAME) | |
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