使用Butterknife注解出现nullPointerException错误

使用Butterknife注解出现nullPointerException异常


IDE是从谷歌安卓官网上下载的ADT Bundle的Eclipse,解压出来就直接能用。但是如果使用开源ButterKnife注入框架,光把jar包扔进项目libs文件夹中去运行项目就会报空指针异常


解放办法:

项目右键的preference里找到Java Compiler,展开后在Annotation Processing节点下配置一些东西,但是发现eclipse没有Annotation Processin,所以要先安装这个插件

  1. 先打开Help菜单,点击Install New Software

使用Butterknife注解出现nullPointerException错误

2 .选择安装Juno:
插件地址:http://download.eclipse.org/releases/juno


        使用Butterknife注解出现nullPointerException错误

3 . 在下面的列表中找到Programming Languages节点并展开,找到Eclipse Java Development Tools,勾选上,剩下的安装步骤你懂的,安装完了会要求自动重启Eclipse,重启后就有Annotation Processing啦。

    使用Butterknife注解出现nullPointerException错误


4.选中Annotation Processing------->勾选enable project specific settings

使用Butterknife注解出现nullPointerException错误


5.展开Annotation Processing------>选中Factory Path ---->勾选enable project specific settings------>add JARs------>选中你的butterknife.jar

使用Butterknife注解出现nullPointerException错误

版权声明:本文为博主原创文章,未经博主允许不得转载。