Created
October 22, 2015 08:25
-
-
Save faruktoptas/e2bcb4796ce4e63c75e6 to your computer and use it in GitHub Desktop.
Rename output apk file (append versionName)
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 -> | |
renameApk(variant, defaultConfig) | |
} | |
} | |
// --------------------------- | |
def renameApk(variant, defaultConfig) { | |
variant.outputs.each { output -> | |
if (output.zipAlign) { | |
def file = output.outputFile | |
def fileName = file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk") | |
output.outputFile = new File(file.parent, fileName) | |
} | |
def file = output.packageApplication.outputFile | |
def fileName = file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk") | |
output.packageApplication.outputFile = new File(file.parent, fileName) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated