i used this code
applicationVariants.all { variant -> variant.outputs.each { output -> def SEP = "_" def flavor = variant.productFlavors[0].name def buildType = variant.variantData.variantConfiguration.buildType.name def version = variant.versionName def date = new Date() def formattedDate = date.format('ddMMyy_HHmm') def newApkName = PROJECT_NAME + SEP + flavor + SEP + buildType + SEP + version + SEP + formattedDate + ".apk" def file = new File(newApkName) output.outputFile = file } }
change the apk file name when creating a new apk, but since I am using Android Studio 3.0 Canary 2 , this error appears:
Unable to set read-only property value 'outputFile' ....
android-studio android-gradle
Mohamd Al-Najjar May 29 '17 at 9:39 a.m. 2017-05-29 09:39
source share