ButterKnife 8.0.1 @BindView 失败,nullpointerexception
来源:互联网 发布:mac os x10.10.5迅雷 编辑:程序博客网 时间:2024/06/04 18:39
ButterKnife 8.0.1
@BindView 失败,空指针异常,跟踪进去,发现是XXXFragment的 XXXFragment$$ViewBinder 的类没有生成。
经过google。发现了解决方案。记录一下。
ButterKnife 8.0.1 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.0.1' apt 'com.jakewharton:butterknife-compiler:8.0.1'}
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.0.1'
没有加上
apt 'com.jakewharton:butterknife-compiler:8.0.1'
所以要在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.0.1' apt 'com.jakewharton:butterknife-compiler:8.0.1'
1 0
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- ButterKnife 8.4.0 @BindView 失败,nullpointerexception
- ButterKnife BindView 失败,报错NullPointerException
- 依赖butterknife:8.8.1 控件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.0.1
- ButterKnife 8.0.1
- 5、Set数据类型
- System Verilog视频学习笔记(5)- Concurrency
- atom安装markdown-preview-enhanced和markdown-pdf插件
- 继续聊WPF——如何获取ListView中选中的项
- VS自带程序打包部署发布
- ButterKnife 8.0.1 @BindView 失败,nullpointerexception
- Windows使用Xshell访问虚拟机的Ubuntu
- 数据传输的常用格式JSON
- python抽象
- 继续聊WPF——设置网格控件列标题的样式
- 关于汽车评测集的朴素贝叶斯分类 -AI实验
- TensorFlow安装要点
- 【数据仓库】【细节】三个例子,让你看懂数据仓库多维数据模型的设计
- Linux