解决Butter Knife 空指针问题

Butter Knife  

是jakewharton 大神写的基于Android开发的依赖注入库。

最近使用发现老是报Nullporinter的错误。

Butter Knife  官网研究后才知道,使用依赖注入需要给java编译器导入java。


解决Butter Knife 空指针问题:

  1. Right click on your project in the Package Explorer. Head to Java Compiler → Annotation Processing and check "Enable project specific settings".

    Ensure the other annotation processing settings are the same as shown below:

  2. Expand the Annotation Processing section and select Factory Path. Check "Enable project specific settings" and then click "Add JARs…". Navigate to the project's libs/folder and select the Butter Knife jar.

    1. Click "Ok" to save the new settings. Eclipse will ask you to rebuild your project to which you should click "Yes"
    2. Make sure that the .apt_generated/ folder is in your project root. It should contain files like YOURACTIVITY$$ViewInjector.java. If these files are not present trigger a clean build by selected Project → Clean. This folder and files should not be checked into revision control.


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值