Android Gradle 3.0.0-alpha2插件,无法设置只读属性'outputFile'的值 [英] Android Gradle 3.0.0-alpha2 plugin, Cannot set the value of read-only property 'outputFile'
本文介绍了Android Gradle 3.0.0-alpha2插件,无法设置只读属性'outputFile'的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此代码
i was using 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
}
}
在我构建新的apk时更改apk文件的名称,但是由于我使用的是 Android Studio 3.0 Canary 2 ,因此会出现以下错误:
无法设置只读属性'outputFile'的值....
to change the name of apk file when i build new apk, but since i use the Android Studio 3.0 Canary 2 this error appear:
Cannot set the value of read-only property 'outputFile'....
推荐答案
查看全文