Android Plugin for Gradle 3.0.0踩坑記錄

android studio 終於迎來了3.0正式版本,早上到公司第一件事情就是一聲號令,升級!
...
升級完成,重啓android studio
編譯失敗....html

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.java

解決:android

 // 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
解決:api

// 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文件加入代碼:app

android.enableAapt2=false
相關文章
相關標籤/搜索