注解工具ButterKnife用法和注意点

// implementation 'com.android.support:appcompat-v7:28.0.0-Beta1'

// implementation 'com.android.support:support-v4:28.2.0'
// implementation 'com.android.support:support-annotations:27.1.1'
// compile "com.android.support:design:${project.supportLibVersion}"
implementation 'com.jakewharton:butterknife:8.8.1'

官方github给出的库引用是:

dependencies {
  implementation 'com.jakewharton:butterknife:8.8.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

但这里第二句的annotationProcessorxxx 加上就会报 android annotation xx不存在,很恶心,拿掉这句,编译完美通过!

另外除了作为lib使用需要加入 apply plugin, 和 在 project的 repo中加入butterknife plugin的代码配置外,正常的引入使用不需要
 
原文地址:https://www.cnblogs.com/bluestorm/p/9267396.html