无法解析符号 'ButterKnife'
Cannot resolve symbol 'ButterKnife'
我正在尝试使用 butterknife。但我收到错误“无法解析符号'**ButterKnife'”。
我试图手动导入 butterknife.ButterKnife 但我得到了同样的错误
我修改了 gradle 并添加了这些行:
在项目层面...
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
在模块级别...
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'
}
我该怎么办?
提前致谢 。
这是我收到错误的代码的屏幕截图
link for the screenshot
compile 'com.jakewharton:butterknife:7.0.1'
试试这个,
compile 'com.jakewharton:butterknife:8.0.0'
apt 'com.jakewharton:butterknife-compiler:8.0.0'
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'
}
请检查official document here。
简而言之,您的依赖项如下所示:
dependencies {
// ... other dependencies here
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
试试这个,
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.tanamo.tutorial"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
试试这个:
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
我正在尝试使用 butterknife。但我收到错误“无法解析符号'**ButterKnife'”。 我试图手动导入 butterknife.ButterKnife 但我得到了同样的错误 我修改了 gradle 并添加了这些行: 在项目层面...
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
在模块级别...
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'
}
我该怎么办? 提前致谢 。 这是我收到错误的代码的屏幕截图 link for the screenshot
compile 'com.jakewharton:butterknife:7.0.1'
试试这个,
compile 'com.jakewharton:butterknife:8.0.0'
apt 'com.jakewharton:butterknife-compiler:8.0.0'
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'
}
请检查official document here。 简而言之,您的依赖项如下所示:
dependencies {
// ... other dependencies here
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
试试这个,
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.tanamo.tutorial"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
试试这个:
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'