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

Configuration on demand is not supported by the current version of the Android Gradle plugin(当前版本的 Android Gradle 插件不支持按需配置)

本文介绍了当前版本的 Android Gradle 插件不支持按需配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 Android Studio 3.1.2 后出现以下错误:

After upgrading to Android Studio 3.1.2 I am getting the following error:

当前版本的 Android Gradle 插件不支持按需配置,因为您使用的是 Gradle 版本 4.6 或更高版本.建议:通过在 gradle.properties 文件中设置 org.gradle.configureondemand=false 来禁用按需配置或使用低于 4.6 的 Gradle 版本.

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.

我尝试按照建议进行操作,但这并没有解决问题.有任何想法吗?非常感谢所有帮助,谢谢.

I attempted following the suggestion but this did not fix the issue. Any ideas? All help is greatly appreciated, thank you.

推荐答案

无需降级!

禁用按需配置需要两个步骤:

  1. 从 gradle.properties 中删除 org.gradle.configureondemand.

在 Android Studio 中,
对于 Mac 转到 Preferences > Build, Execution, Deployment > Compiler 并取消选中按需配置.
对于 Linux/Windows 转到 File > Settings > 构建、执行、部署 > 编译器 并取消选中按需配置.

In Android Studio,
For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand.
For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand.

注意,有2个gradle.properties文件

  1. 在你的项目中gradle.properties
  2. ${HOME}/.gradle/gradle.properties

这篇关于当前版本的 Android Gradle 插件不支持按需配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:当前版本的 Android Gradle 插件不支持按需配置

基础教程推荐