ButterKnife 8.4.0 @BindView 失败,nullpointerexception
来源:互联网 发布:科比常规赛数据统计 编辑:程序博客网 时间:2024/05/16 09:05
ButterKnife 8.4.0
@BindView 失败,空指针异常,跟踪进去,发现是XXXFragment的 XXXFragment$$ViewBinder 的类没有生成。
经过google。发现了解决方案。记录一下。
ButterKnife 8.4.0 not working
Per the readme, you need to include the butterknife-compiler
in order for the generated code to be produced automatically:
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' }}apply plugin: 'com.neenbedankt.android-apt'dependencies { compile 'com.jakewharton:butterknife: 8.4.0
'apt 'com.jakewharton:butterknife-compiler:8.0'}
Without this there is no generated code to be loaded and thus none of the fields get set.
You can verify ButterKnife is working by calling ButterKnife.setDebug(true)
and looking in Logcat
简单的说呢。就是之前只加了
compile 'com.jakewharton:butterknife:
8.4.0
'
没有加上
apt 'com.jakewharton:butterknife-compiler:
8.4.0
'
所以要在Module的build.gradle 加上
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
在app 的build.gradle
顶部加上
apply plugin: 'com.neenbedankt.android-apt'
dependencies
加上
compile 'com.jakewharton:butterknife:8.4.0' apt 'com.jakewharton:butterknife-compiler:8.4.0'
1 0
- ButterKnife 8.4.0 @BindView 失败,nullpointerexception
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife BindView 失败,报错NullPointerException
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- Android Butterknife 8.4.0 使用时报错java.lang.NullPointerException
- ButterKinfe.bind(this) @BindView时出现NullPointerException
- android使用butterknife InjectView和BindView
- Butterknife bindview @OnClick绑定多控件id
- android butterknife NullPointerException 解决方法
- butterknife 混淆 NullpointerException
- ButterKnife 报NullPointerexception
- ButterKnife使用出现Nullpointerexception
- 使用butterknife的BindView时报错@BindView not applicable to type
- 浅析ButterKnife的实现 (三) —— BindView
- ButterKnife.bind(this)发生NullPointerException
- butterknife 8.4.0
- 学习ButterKnife 8.4.0
- Kafka动态增加Topic的副本(Replication)
- 用sublime text3 编译less并且转换成css
- QT设置鼠标指针位置
- Java集合学习中需要注意的一个点
- Java中的输入输出总结
- ButterKnife 8.4.0 @BindView 失败,nullpointerexception
- 微信抢红包iOS版
- Java基本环境搭建
- Dorado 7 dataset 使用数据 js
- Java访问权限控制简述
- 构造函数到底是干什么的?
- Java中的输入输出总结
- iOS快速理解iOS中的MVC架构模式
- <Android 基础(三十三)> TabHost ~ 仿微信底部菜单