首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析符号“ButterKnife”

无法解析符号“ButterKnife”
EN

Stack Overflow用户
提问于 2017-02-10 09:32:26
回答 6查看 10.4K关注 0票数 1

我在试着用蝴蝶刀。但我得到了错误“无法解析符号‘**蝴蝶刀’”。我尝试手动导入butterknife.ButterKnife,但是我得到了相同的错误,我修改了gradle并添加了这些行:在项目级别.

代码语言:javascript
复制
dependencies {
              classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
             }

在模块级..。

代码语言:javascript
复制
apply plugin: 'com.android.application' 
apply plugin: 'android-apt'

dependencies { 

   compile 'com.jakewharton:butterknife-compiler:8.5.1'
   apt 'com.jakewharton:butterknife-compiler:8.5.1' 

}

我该怎么办?提前谢谢。下面是我得到错误屏幕截图链接的代码的屏幕截图

EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2017-02-10 09:37:38

代码语言:javascript
复制
apply plugin: 'com.android.application'
android {
    compileSdkVersion XX
    buildToolsVersion "XX.0.0"
    defaultConfig {
        applicationId "com.xxxxx.xxx"
        minSdkVersion xx
        targetSdkVersion xx
        versionCode x
        versionName "x.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}


apply plugin: 'com.neenbedankt.android-apt'


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.code.findbugs:jsr305:2.0.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.jakewharton:butterknife:8.0.1'

    apt 'com.jakewharton:butterknife-compiler:8.0.1'
    testCompile 'junit:junit:4.12'
}
票数 3
EN

Stack Overflow用户

发布于 2017-02-10 09:34:49

代码语言:javascript
复制
compile 'com.jakewharton:butterknife:7.0.1'
票数 1
EN

Stack Overflow用户

发布于 2017-02-10 09:37:19

尝尝这个,

代码语言:javascript
复制
compile 'com.jakewharton:butterknife:8.0.0'
apt 'com.jakewharton:butterknife-compiler:8.0.0'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42155896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档