butterknife8.2.1使用

一、打开Project的build.gradle文件,修改buildscript,添加

classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’

添加之后代码如下:

dependencies {    
    classpath 'com.android.tools.build:gradle:2.0.0'    
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'    
    // NOTE: Do not place your application dependencies here; they belong    
    // in the individual module build.gradle files
}

二、打开Module的build.gradle文件,添加

applyplugin:'android-apt'
添加之后代码如下:

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

三、Module的build.gradle文件dependencies中添加

apt'com.jakewharton:butterknife-compiler:8.2.1'
添加之后代码如下:

dependencies {    
    compile fileTree(include: ['*.jar'], dir: 'libs')testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.jakewharton:butterknife:8.2.1'
    compile 'com.android.support:design:23.1.1'
    compile files('libs/Android_RTCM_SDK_v1.0.6_rtk_15.jar')
    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
    compile files('libs/nagrand-jar-with-dependencies.jar')
    apt 'com.jakewharton:butterknife-compiler:8.2.1'
}

你可能感兴趣的:(butterknife8.2.1使用)