ButterKnife 8.4注入失败

1,第一步:项目的gradle中增加 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}

2,第二步:在使用ButterKnife框架的相应gradle中增加如下
2.1
apply plugin: 'com.android.application'
apply plugin: 'android-apt'

2.2
android {
  compileOptions {
  sourceCompatibility JavaVersion.VERSION_1_7
  targetCompatibility JavaVersion.VERSION_1_7
  }

}

2.3
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
  compile "com.jakewharton:butterknife:8.4.0"
  apt "com.jakewharton:butterknife-compiler:8.4.0"
}
posted @ 2017-05-02 11:20  ytymz  阅读(241)  评论(0编辑  收藏  举报