Unable to find method'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List' 构建错误解决办法

Unable to find method'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List'
Possible causes for this unexpected error include:

Gradle’s
dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process(daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-part y plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

出现这个错误之后,我也是第一时间地按照提示信息的方法,也就是Re-download dependencies and sync project和Stop Gradle build processes,然后发现起不了任何作用,也尝试过clean project,都没有任何作用,去网上找了一下方法,大概就是以下这几种解决方法:

1. 插件不兼容
说的比较多的就是Butterknife8.8.1插件与当前的gradle不兼容
判断是不是该问题的最简单方法就是将build.gradle中apply plugin: 'com.jakewharton.butterknife'给注释掉,再次build看有没有报错,如果没有那就是插件不兼容导致的,相关的解决办法,可以参照:

解决添加Butterknife8.8.1依赖后出错的问题

2. 版本有问题
这种情况只有退回到原版本,这是最快的解决办法

退回方法:

1. 如果之前使用的是本地gradle,找到自己下载的Gradle包进行配置

2. 如果不是,就去到刚才提到的C:\Users\ zsk(你的计算机名)\ .gradle\wrapper\dists目录下,参考你之前使用的gradle版本,一般是版本最小的那个,多个版本的还需自己判断打开项目,编辑gradle-wrapper.properties文件,将图中红框内的内容改成对应的更新前使用的版本号

3. 更改对应的Gradle插件编辑project的build.gradle文件,将图中红框处的版本号更改为当前gradle对应插件的版本号,不是刚才      gradle的版本号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值