【Android】AS報錯:Configuration on demand is not supported by the current version of the Android Gradle

轉載請註明出處,原文鏈接:https://blog.csdn.net/u013642500/article/details/80218299

【錯誤】

Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. 

Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.

【翻譯】

由於使用你正在使用 Gradle 版本4.6或以上,當前版本的Android的 Gradle 插件不支持按需配置。

建議:通過在你的 gradle.properties 文件中設置 org.gradle.configureondemand=false 禁用按需配置,或者使用一個低於4.6版本的 Gradle。

【解決方法1:降級】

打開 gradle-wrapper.properties 文件,修改 distributionUrl 參數,將其後面修改爲低於4.6版本的 Gradle。如:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip


【解決方法2:禁用按需配置】

1、打開 gradle.properties 文件,共有兩個:Global PropertiesProject Properties,將其中的

org.gradle.configureondemand=true

修改爲

org.gradle.configureondemand=false
或刪除該語句,或註釋掉該語句。


2、通過 File 菜單,點擊 Settings,或按 Ctrl+Alt+S 打開設置。


3、找到 Build, Execution, Deployment 裏面的 Compiler,將右面的 Configure on demand 取消勾選。


【注意事項】

方法2中,第一步的 gradle.properties 文件,共有兩個:Global Properties 和 Project Properties,全都需要修改。

【說明】

本文可能未必適用所有情形,本人尚屬初學者,如有錯誤或疑問請評論提出,由衷感謝!


參考鏈接:https://stackoverflow.com/questions/49990933

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章