I want to generate output apk file using customized name. Eg. By default, android studio generates "app-debug.apk" file. But I want it to be - "MyAppName_myCurrentProdFlavour_vMyVersionName.apk" How to do this using build.gradle file of module
Before app_debug.apk
After com.pcvark.jobtest-v1(1.0)-debug.apk
android {
..
defaultConfig {
...
setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")")
}
Tip You can also set versionNameSuffix
for different buildType
and variant (if you have). This will make different named apk for both debug
and release
.
buildTypes {
debug {
versionNameSuffix "-T"
}
release {
versionNameSuffix "-R"
}
}
Further reading
https://stackoverflow.com/a/20660274/6891563
https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With