android - ButterKnife 编译错误 : error duplicate class

标签 android gradle android-studio build.gradle butterknife

我在构建项目时遇到此错误:

错误:类重复:class_name$$ViewInjector

enter image description here

这是我的 build.gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
    applicationId "com.stel.order"
    minSdkVersion 9
    targetSdkVersion 19
}

buildTypes {
    release {
        runProguard true
        proguardFiles 'proguard-project.txt'
    }
}
}

dependencies {  
  compile 'com.google.code.gson:gson:2.2.4'   
  compile 'com.jakewharton:butterknife:6.0.0'
  ...
}

如果我清理项目,它构建时没有错误,但是当我运行项目时,我得到这个错误。

最佳答案

当我从 Eclipse 迁移时,它也发生在我身上。您只需手动删除项目中的文件 path.OuterClass$$ViewInjector

关于android - ButterKnife 编译错误 : error duplicate class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26904536/

相关文章:

javascript - 在 js 文件中为网络故障覆盖 "Error Loading Page"

java - Android - 源端口 800 的 DatagramSocket 不发送

找不到安卓 NavigationView

java - 该配置引用了未知类 'String'

android - 定制设计EditText

android - 创建一个没有透明度的波纹可绘制对象

Android Studio 3.1 Canary 3 - Gradle 同步失败

java - 在 groovy 中使用 HTML 格式的 JIRA Rest API 创建发行说明

android - 街景在 android 应用程序中显示错误消息

android - 在 Android Studio 中构建项目时出错