How to Rename and Generate all APK & Bundle from Gradle with Product flavour and APK Splits
As per This answer, you can go with Option - Two
with minor changes as mention below
splits {
abi {
enable true
reset()
include 'arm64-v8a', 'x86', 'x86_64'
universalApk false
}
}
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
// New one or Updated one
output.outputFileName = "${variant.getFlavorName()}-${variant.buildType.name}-v${versionCode}_${versionName}-${new Date().format('ddMMMyyyy_HH-mm')}-${output.getFilter(com.android.build.OutputFile.ABI)}.apk"
// Old one
// output.outputFileName = "${variant.buildType.name}-v${versionCode}_${versionName}-${new Date().format('ddMMMyyyy_HH-mm')}.apk"
}
}
Also, remove the line from each Flavor's block
// To Change the APK and Bundle Name
archivesBaseName = "${name}-v${versionCode}_${versionName}-${new Date().format('ddMMMyyyy_HH-mm')}"
By this, you get the output file name like this
For aFlvour
- Release
aFlavor-release-v5_1.0.5-16Jan2020_21-26-arm64-v8a.apk
aFlavor-release-v5_1.0.5-16Jan2020_21-26-x86_64.apk
aFlavor-release-v5_1.0.5-16Jan2020_21-26-x86.apk
- Debug
aFlavor-debug-v5_1.0.5-16Jan2020_21-26-arm64-v8a.apk
aFlavor-debug-v5_1.0.5-16Jan2020_21-26-x86_64.apk
aFlavor-debug-v5_1.0.5-16Jan2020_21-26-x86.apk
For bFlavor
Similar name as above just change the prefix aFlavor
with bFlavor
like
bFlavor-release-v5_1.0.5-16Jan2020_21-26-arm64-v8a.apk
For cFlavor
Similar name as above just change the prefix aFlavor
with cFlavor
and, versionCode
and versionName
as respected
cFlavor-release-v3_1.0.3-16Jan2020_21-26-arm64-v8a.apk