Android知识

Error:Unable to find method 'com

2017-12-04  本文已影响0人  Android扫地僧

Android studio升级3.0后与ButterKnife兼容性报错

Error: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)](http://www.jianshu.com/syncProject)
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)](http://www.jianshu.com/stopGradleDaemons)
Your project may be using a third-party 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.

两种解决办法:

1. 升级ButterKnife到9.0.0-SNAPSHOT

buildscript {
    repositories {
    google()
    jcenter()
    maven {url"https://oss.sonatype.org/content/repositories/snapshots"}
}
dependencies {
    classpath'com.android.tools.build:gradle:3.0.0'
    classpath'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
  1. 降级ButterKnife到8.4.0

GitHub Issue链接https://github.com/JakeWharton/butterknife/issues/963

上一篇下一篇

猜你喜欢

热点阅读