Output result: AppNameProd4.1.2_050718.apk
android { applicationVariants.all { variant -> variant.outputs.all { def flavor = variant.productFlavors[0].name.capitalize() def version = variant.versionName def date = new Date() def formattedDate = date.format('ddMMyy') outputFileName = "AppName${flavor}${version}_${formattedDate}.apk" } } }
If you need a buildType name:
def buildType = variant.variantData.variantConfiguration.buildType.name
Version code:
def versionCode = variant.versionCode