Last active
January 30, 2017 15:48
-
-
Save OSemenovBoyarka/dc3e63fd6776469aff13 to your computer and use it in GitHub Desktop.
build.gradle extension to rename all output apks to <name>-<version>-<version_code> template
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 -> | |
variant.outputs.each { output -> | |
def filename = output.outputFile.name.replace(".apk", "-" + variant.versionName+"-"+variant.versionCode + ".apk") | |
//we should replace this only for release builds, because it cause bugs in development | |
if (filename.contains("release")){ | |
output.outputFile = new File(getProject().getRootDir(), | |
"${getProject().getName()}${File.separator}apk${File.separator}${filename}") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment