Androidstudio3.0 关于Gradle报错的问题

来源:互联网 发布:mac 查看硬盘内存 编辑:程序博客网 时间:2024/06/06 16:38

前言

升级Android Studio to 3.0 canary 1版本后,之前一个正常的Project,一直报错,报错内容如下

Error:Failed to complete Gradle execution.Cause:The version of Gradle you are using (3.3) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

这可把我坑苦了,手动下载Gradle,各种Clean,完全没有效果,坑爹的度娘也没给出好办法

解决

没办法,翻墙找谷歌爸爸看看,在 Stack Overflow上找到相同问题,
Gradle version 3.3 does not support forTask() method on BuildActionExecuter,方法:
gradle-wrapper.propertie

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

改为

distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip

clean一遍,大功告成,编译之后,会变成

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

错误搞定,目前还没搞懂为什么会出现这个错误