黄牛刀的引入ButterKnife

配置请参考这个:https://www.jianshu.com/p/c61172bfa49b
过程中如果出现:

Error:android-apt plugin is incompatible with the Android Gradle plugin.  
Please use 'annotationProcessor' configuration instead.
  1. 注释掉 apply plugin: ‘android-apt’
apply plugin: 'com.android.application'
//apply plugin: 'android-apt'
  1. 把dependencies下的 apt 全部改为 annotationProcessor
//    apt 'com.jakewharton:butterknife-compiler:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

至于原理可以看这个:https://www.jianshu.com/p/39fc66aa3297

使用方式:https://www.cnblogs.com/xqz0618/p/butterknife.html

猜你喜欢

转载自blog.csdn.net/weixin_41805792/article/details/89706954