用户登录
用户注册

分享至

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

  • 作者: 有赞必回请多支持
  • 来源: 51数据库
  • 2022-11-02

问题描述

升级到 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
软件
前端设计
程序设计
Java相关