注解工具ButterKnife用法和注意点

本文介绍在项目中集成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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值