android - 找不到 butterknife 的符号类绑定(bind)

标签 android android-gradle-plugin butterknife

不知何故,我的 gradle 构建出现了错误。不知何故,我找不到 butterknife 的 Bind 类。

这可能是由于我的gradle,但我不知道。

我收到这个错误:

Error:(40, 6) error: cannot find symbol class Bind

我的成绩文件是这样的:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "de.andreasschrade.androidtemplate"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:${android_support_lib_version}"
    compile "com.android.support:design:${android_support_lib_version}"
    compile "com.android.support:cardview-v7:${android_support_lib_version}"

    compile 'com.github.bumptech.glide:glide:3.6.1'
    //compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.retrofit2:retrofit:2.0.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0'

    // api
    //compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-moshi:2.3.0'
    //compile 'com.android.support:design:25.4.0'
    compile 'com.jakewharton:butterknife:8.6.0'
    compile 'com.basgeekball:awesome-validation:2.0'
    compile 'com.facebook.stetho:stetho:1.5.0'
    compile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}

最佳答案

使用@BindView (butterknife:8.6.0) 而不是@Bind (butterknife:7.0.1)

关于android - 找不到 butterknife 的符号类绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45255089/

相关文章:

android - 无法解决 ':app@debug/compileClasspath' : Could not resolve com. android.support :appcompat-v7:26. 1.0 的依赖关系

android - Gradle Sync 在新项目上失败 Unexpected ZLIB Input Stream

android - Butterknife android 示例总是显示 NoClassDefFoundError

java - Butterknife 上的点击不起作用

android - 找不到com.affolestad.material-dialogs

android - 如何管理 Activity 堆栈?

android - 穿戴设备和移动设备的不同文本

android - 当我从列表中选择一个项目时回来

android - 从守护程序 : '...' is a result of a type we don't have a strategy to handle 收到无效响应

android - 如何在从某个 View 找到的 View 中设置 butterknife 中的点击监听器?