Butter Knife地址:http://jakewharton.github.io/butterknife
首先我们看Butter Knife官网的教程:
- buildscript {  
-   repositories {  
-     mavenCentral()  
-    }  
-   dependencies {  
-     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'  
-   }  
- }  
-   
- apply plugin: 'com.neenbedankt.android-apt'  
-   
- dependencies {  
-   compile 'com.jakewharton:butterknife:8.0.1'  
-   apt 'com.jakewharton:butterknife-compiler:8.0.1'  
- }  
按照上述配置,你可能会出现编译上的问题,如找不到com.neenbedankt.Android-apt等问题。
经过测试,总算搞清楚了问题。
首先看下面的工程目录:

 
httptest/build.gradle配置文件中添加:
- buildscript {  
-     repositories {  
-         jcenter()  
-     }  
-     dependencies {  
-         classpath 'com.android.tools.build:gradle:2.1.0'  
-         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'  
-     }  
- }  
也就是我们修改gradle版本的那个build文件。
app/build.gradle配置文件中如下:
- apply plugin: 'com.android.application'  
- apply plugin: 'com.neenbedankt.android-apt'  
-   
- android {  
-     compileSdkVersion 23  
-     buildToolsVersion "23.0.3"  
-   
-     defaultConfig {  
-         applicationId "com.baidu.retrofitdemo"  
-         minSdkVersion 16  
-         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'])  
-     testCompile 'junit:junit:4.12'  
-     compile 'com.android.support:design:23.3.0'  
-     compile 'com.android.support:appcompat-v7:23.3.0'  
-     compile 'com.squareup.okhttp3:okhttp:3.2.0'  
-     compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'  
-     compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'  
-     compile 'com.jakewharton:butterknife:8.0.1'  
-     apt 'com.jakewharton:butterknife-compiler:8.0.1'  
- }  
如此,clean下就可以使用了。