当前位置:   article > 正文

当前版本的Android Gradle插件不支持按需配置_org.gradle.configureondemand

org.gradle.configureondemand

本文翻译自:Configuration on demand is not supported by the current version of the Android Gradle plugin

After upgrading to Android Studio 3.1.2 I am getting the following error: 升级到Android Studio 3.1.2后,我收到以下错误:

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. 由于您使用的是Gradle 4.6或更高版本,因此当前版本的Android Gradle插件不支持按需配置。 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.properties文件中设置org.gradle.configureondemand = false或使用小于4.6的Gradle版本,按需禁用配置。

I attempted following the suggestion but this did not fix the issue. 我试图遵循这个建议,但这并没有解决问题。 Any ideas? 有任何想法吗? All help is greatly appreciated, thank you. 非常感谢所有帮助,谢谢。


#1楼

参考:https://stackoom.com/question/3NkvN/当前版本的Android-Gradle插件不支持按需配置


#2楼

I get same error after update to AS 3.1.2. 更新到AS 3.1.2后,我得到相同的错误。 You can still use Gradle version 4.6 but downgrade Android gradle plugin to 3.1.1 您仍然可以使用Gradle 4.6版,但将Android gradle插件降级为3.1.1

EDIT: just invalidate cache and restart 编辑:只是使缓存无效并重新启动


#3楼

No need to downgrade! 无需降级!

Disabling configure on demand requires two steps: 禁用按需配置需要两个步骤:

  1. Remove org.gradle.configureondemand from gradle.properties. 删除org.gradle.configureondemand从gradle.properties。

  2. In Android Studio, 在Android Studio中
    For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand. 对于Mac,请转到“ Preferences >“ Build, Execution, Deployment >“ Compiler然后取消选中“按需配置”。
    For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand. 对于Linux / Windows,请转到File > Settings > Build, Execution, Deployment > Compiler然后取消选中按需配置。

Note, there are 2 gradle.properties files 注意,有2个gradle.properties文件

  1. In your project gradle.properties 在您的项目gradle.properties
  2. ${HOME}/.gradle/gradle.properties

#4楼

在Android Studio中,只需转到文件 - >设置 - >构建,执行,部署 - >编译器 ,然后单击以取消选中“ 按需配置”选项 ,然后再次单击“确定”和“ 同步项目与gradle文件”


#5楼

Invalidate cache and restart/disabling configure on demand did not work for me. 无效缓存和重启/禁用按需配置对我不起作用。 The only solution that helped me is to import the project from git again. 帮助我的唯一解决方案是再次从git导入项目。

[UPD] Need to change "com.android.tools.build:gradle" from 3.1.2 to 3.1.1 [UPD]需要将“com.android.tools.build:gradle”从3.1.2更改为3.1.1


#6楼

The @wookupmaker answer is correct. @wookupmaker的答案是正确的。 But, if it still doesn't work, the problem migh be a global gradle.properties. 但是,如果它仍然不起作用,问题可能是全局 gradle.properties。

Even if I tried to override 即使我试图覆盖

org.gradle.configureondemand=false org.gradle.configureondemand = FALSE

in my local(project specific) gradle.properties, somehow it did not work. 在我的本地(项目特定的)gradle.properties中,不知何故它不起作用。

After editing global (~/.gradle/gradle.properties) it worked as expected 编辑全局(〜/ .gradle / gradle.properties)后,它按预期工作

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/244419
推荐阅读
相关标签
  

闽ICP备14008679号