Last active
December 11, 2021 09:13
-
-
Save twocity/8121849 to your computer and use it in GitHub Desktop.
android gradle change output apk file name.
This file contains hidden or 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 -> | |
println "*********" + variant.description + "**********"; | |
def variants = variant.baseName.split("-"); | |
def apkName = "ricebook-"; | |
apkName += variants[0]; | |
apkName += "-v" + android.defaultConfig.versionName; | |
if (!variant.zipAlign) { | |
apkName += "-unaligned"; | |
} | |
if (variant.buildType.name == "release") { | |
apkName += "-RELEASE.apk"; | |
} else { | |
apkName += "-SNAPSHOT.apk"; | |
} | |
println "*********" + "$project.buildDir/apk/" + apkName + "**********"; | |
variant.outputFile = file("$project.buildDir/apk/" + apkName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
android {
}