android studio中library使用butterknife(黄油刀)注解方法

1.Project build.gradle 添加:

    dependencies {        
            classpath 'com.jakewharton:butterknife-gradle-plugin:8.2.1'
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        }

2.library module build.gradle 添加:

apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'android-apt'
dependencies {    
    //butterknife
    compile 'com.jakewharton:butterknife:8.2.1'
    apt 'com.jakewharton:butterknife-compiler:8.2.1'
}

3.主module build.gradle 添加:

apply plugin: 'android-apt'
dependencies {    
    compile 'com.jakewharton:butterknife:8.2.1'
    apt 'com.jakewharton:butterknife-compiler:8.2.1'
}

参考地址:http://www.jianshu.com/p/b0bfa3611b86

你可能感兴趣的:(android笔记)