无法设置只读属性的值" outputFile'

时间:2017-10-29 10:35:50

标签: android

我更新到Android 3.0 4.0级

如何修复问题?

applicationVariants.all { variant ->
        variant.outputs.all { output ->
            output.outputFile = file("$project.buildDir/apk/" + newName);
            if (output.zipAlign) {
                output.zipAlign.outputFile =
                        file("$project.buildDir/apk/" + newName.replace("-unaligned", ""));
            }

无法设置只读属性的值" outputFile' ....

1 个答案:

答案 0 :(得分:3)

根据the documentation将值分配给outputFileName

android.applicationVariants.all { variant ->
    variant.outputs.all {
        outputFileName = "${variant.name}-${variant.versionName}.apk"
    }
}