本文翻译自: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)后,它按预期工作

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

  1. 小记Android Gradle插件 Iven 记于 20190522 药厂

    2016.04年 Android Gradle插件2.x 通过支持字节码注入,将代码和资源更新推送到模拟器或物理设备上正在运行的应用程序,启用Instant Run. 添加了对增量构建的支持,即使应用 ...

  2. 【Android Gradle 插件】自定义 Gradle 插件优化图片 ① ( Android 中的 WebP 图片格式使用 | WebP 格式转换 | WebP 参考文档 )

    文章目录 一.Android 中的 WebP 图片格式使用 二.WebP 格式转换 三.WebP 参考文档 Android Plugin DSL Reference 参考文档 : Android St ...

  3. Android Gradle 插件版本说明

    Android Studio 构建系统以 Gradle 为基础,并且 Android Gradle 插件添加了几项专用于构建 Android 应用的功能.虽然 Android 插件通常会与 Andro ...

  4. 【Android Gradle 插件】ProductFlavor 配置 ( ProductFlavor#buildConfigField 方法 | 单独编译生成 BuildConfig 类的任务 )

    文章目录 一.ProductFlavor#buildConfigField 方法 二.单独执行 Gradle 编译 BuildConfig 的任务 Android Plugin DSL Referen ...

  5. 【Android Gradle 插件】Android Plugin DSL Reference 离线文档下载 ( GitHub 下载文档 | 查看文档 )

    文章目录 一.Android Plugin DSL Reference 文档下载 二.Android Plugin DSL Reference 文档查看 一.Android Plugin DSL Re ...

  6. 【Android Gradle 插件】Extension 扩展类型 ( Module 引入插件类型 | application 插件 | library 插件 | Variants 变体列表 )

    文章目录 一.Module 引入插件类型 1.com.android.application 插件 2.com.android.library 插件 二.Extension 扩展类型 三.applic ...

  7. 【Android Gradle 插件】工程根目录下 build.gradle 配置文件 ( 远程仓库配置 | 依赖配置 | 所有子模块配置 | task clean 任务 )

    文章目录 一.工程根目录下 build.gradle 配置文件 1.基本作用 2.远程仓库配置 3.依赖配置 3.所有子模块配置 4.task clean 任务 Android Plugin DSL ...

  8. android gradle proguard,Android Gradle插件2.2.0 ProGuard开始保留内部类

    在将Android Studio更新为2.2版并将Android Gradle插件更新为2.2.0之后,在构建发行版apk时会有很多警告,例如: Error:warning: Ignoring Inn ...

  9. 各个 Android Gradle 插件版本所需的 Gradle 版本

    下表列出了各个 Android Gradle 插件版本所需的 Gradle 版本. 要获得最佳性能,您应该使用 Gradle 和插件这两者的最新版本. 插件版本 所需的 Gradle 版本 1.0.0 ...

最新文章

  1. 查看显卡显存_强力散热别浪费 显卡超频这样搞
  2. ftl模板导出excel_freemarker导出复杂Excel
  3. C++ Builder初学问与答(十三)
  4. Linux 系统服务管理(启动服务/停止服务/重启服务)的命令 - chkconfig/service/systemctl
  5. c++面向对象高级编程 学习七 转换函数
  6. java 正则表达式的包_用于Java包名称的Python正则表达式
  7. MyEclipse下开发Web Service(转)
  8. neo4j python可视化_Python使用py2neo操作图数据库neo4j的方法详解
  9. Python的动态特性(类实例增加属性,动态变量类型)
  10. html看图识颜色,canvas 识别图片颜色 解析图片颜色
  11. 美团工作10个月心得
  12. 软件测试如何设计测试用例
  13. 如何打开caj文件?能转成PDF吗?
  14. 常用adb命令学习:查看和修改设备的输入法
  15. ReactNative 公共脱敏处理js 包括银行卡 身份证号 手机号企业名称 营业执照 邮箱号码 等等
  16. 【ICPC模板】卡迈克尔函数
  17. linux 远程唤醒命令,使用命令行远程网络唤起主机
  18. AES加密与解密(秘钥)
  19. 2022年全球市场软铁氧体粉末总体规模、主要生产商、主要地区、产品和应用细分研究报告
  20. 我的世界启动侠启动器java_我的世界启动侠 2020.8云启动版

热门文章

  1. 图像处理 - 滤波器 Filter
  2. 读取sd卡下图片,由图片路径转换为bitmap
  3. Windows2008R2部署SharePoint Server 2013(2)---安装篇
  4. [2005.04.24 20:47:26] 实践与思考之窥索[原创]
  5. python爬虫Day1(requests基本使用)
  6. awesome python 中文版 相见恨晚!(pythonNB的第三方资源库)
  7. MySQL 报错记录
  8. Centos7安装maven过程
  9. yii 操作数据库的三种方法
  10. 【番外篇】ASP.NET MVC快速入门之免费jQuery控件库(MVC5+EF6)