android studio3.0使用butterknife

如果你的项目使用butterknife配置如下:

  • Project gradle config
repositories {
       google()
       jcenter()
       mavenCentral()
    }
dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}
  • module gradle config
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
dependencies {
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

出现以下错误:

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)
- 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-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.

那么Use 9.0.0-SNAPSHOT for now:

  • 配置repositories url
repositories {
        ---
        maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}
    }
allprojects {
    repositories {
        ---
        maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}
    }
}.

然后将8.8.1改为9.0.0-SNAPSHOT

参考 butterknife issue

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,087评论 19 139
  • J神说需要更新测试版本9.0.0-SNAPSHOT为了支持AGP 3.0。 Github issue#863给出了...
    minminaya阅读 3,798评论 1 2
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,989评论 6 342
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,944评论 25 709
  • 我会在什么时刻遇到你呢? 我希望我遇见你时,你戴一顶帽子,脸上印下的阴影和放荡不羁的笑容。 我希望我遇见你时,你穿...
    微依阅读 371评论 0 1