ButterKinfe.bind(this) @BindView时出现NullPointerException
来源:互联网 发布:淘宝介入能撤销吗 编辑:程序博客网 时间:2024/05/30 23:24
ButterKnife版本 8.4.0,@BindView会出现空指针异常,然后我把@BindView换成了findViewById还是报错
网上逛论坛发现,ButterKnife 8.0.1的很多使用者都会出现这种错误,究竟为什么会出现这种错误呢?
原因貌似是我们只是简单的在build,gradle添加了声明
compile 'com.jakewharton:butterknife:8.0.1'
除此之外还要在app下的build.gradle文件中添加一些配置:添加apt声明
compile 'com.jakewharton:butterknife:8.4.0'apt 'com.jakewharton:butterknife-compiler:8.4.0'
在依赖前面加上buildscript声明
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' }}apply plugin: 'com.neenbedankt.android-apt'dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations'sync就不会出现空指针异常了!
阅读全文
0 0
- ButterKinfe.bind(this) @BindView时出现NullPointerException
- ButterKnife.bind(this)发生NullPointerException
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.4.0 @BindView 失败,nullpointerexception
- ButterKnife BindView 失败,报错NullPointerException
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- Android RelativeLayout.mesure()时出现NullPointerException异常
- HttpServlet中init()重写时出现NullPointerException
- 还有可能出现NullpointerException
- ButterKnife使用出现Nullpointerexception
- $(this).bind("change",itemno_change);
- react系列-bind this
- React的bind(this)
- ES6 中的 bind(this)
- android中调用findViewById时出现:java.lang.NullPointerException
- Android使用HttpClient时出现的 java.lang.NullPointerException提示
- Java JSONObject数组使用时出现"nullpointerexception"的解决办法
- I/0多路复用之epoll
- 手机端调试的小技巧
- js控制滚动条的位置
- JAVA通过模板生成DOCX文档(2)
- iOS
- ButterKinfe.bind(this) @BindView时出现NullPointerException
- UFLDL教程:Exercise:Vectorization
- jquery切换图标选项卡
- 内核申请内存
- maven项目在eclipse的library中没有Maven Dependencies
- JSP页面下拉列表中选中的值传递到文本框中
- LeetCode 39. Combination Sum and LeetCode 40. Combination Sum II
- 在kotlin中使用RecyclerView
- 费用流——洛谷P3381 【模板】最小费用最大流