android studio 终于迎来了3.0正式版本,早上到公司第一件事情就是一声号令,升级!
...
升级完成,重启android studio
编译失败....
Error:(137, 0) Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=IAskDoctorDebug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.
解决:
// If you use each() to iterate through the variant objects,
// you need to start using all(). That's because each() iterates
// through only the objects that already exist during configuration time—
// but those object don't exist at configuration time with the new model.
// However, all() adapts to the new model by picking up object as they are
// added during execution.
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
解决:
// Specifies two flavor dimensions.
flavorDimensions "debug"
productFlavors {
free {
// Assigns this product flavor to the "tier" flavor dimension. Specifying
// this property is optional if you are using only one dimension.
dimension "debug"
...
}
paid {
dimension "debug"
...
}
}
Error:(2876) style attribute '@android:attr/windowEnterAnimation' not found.
Error:(2877) style attribute '@android:attr/windowExitAnimation' not found.
Error:failed linking references.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processMDebugResources'.
> Failed to execute aapt
解决:
在gradle.properties文件加入代码:
android.enableAapt2=false