更新 Android Studio3.0后报错
Butanediol opened this issue · 2 comments
Butanediol commented
Error:(31, 0) Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.
Open File
Butanediol commented
初步解决了这个问题
将app/build.gradle中的部分代码改为:
buildTypes {
release {
shrinkResources false // Keep false, or icons in /drawable-nodpi/ will become black.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// For formatting apk file name, like com.by_syk.template_v1.0.0(17012500).apk
android.applicationVariants.all { variant ->
variant.outputs.all { output -> //这里有变动
def outputFile = output.outputFile
if (outputFile != null) {
def fileName = "${defaultConfig.applicationId}_v${defaultConfig.versionName}(${defaultConfig.versionCode}).apk"
outputFileName = fileName //这里有变动
}
}
}
}
}
by-syk commented
谢谢反馈,我会尽快更新代码。你是第一个为代码提出 issue 的用户,十分感谢。