I have an app with more than a few buildFlavors
and three different buildTypes
.
I generate the signed apks from Build -> Generate Signed APK...
. (Unless there is no other go I'd like to continue using the wizard and not create a script, because i have a constantly increasing set of apps and do not want to modify the script every time.)
The generated apks are named in the following pattern:
app-flavorName-buildType.apk
How can i change the naming pattern to something like this:
app_flavorName_buildType_versionCode.apk
Changes I want to make:
versionCode
I used to do it in ant
using task
, but not sure how to do it with gradle
.
Trying to figure a solution to create the name straight away in the new pattern rather than trying to rename it once it is generated. Is that possible?
I tried looking under Settings -> Gradle
but did not find anything. Any other place i should be looking?
It is not exactly what you are looking for.
You can use your build.gradle to set this attribute:
android {
//...
defaultConfig {
//...
project.ext.set("archivesBaseName", "app_"+ defaultConfig.versionCode);
}
}
Assigning the archivesBaseName
you will obtain something like:
app_0.9.6-flavorName-buildType.apk
This attribute requires the gradle-plugin 1.3.1
or higher.
Otherwise you have to use a task to rename the apk after building.
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