您的位置:首页 > Web前端

ButterKnife使用出现Nullpointerexception

2017-11-10 11:52 459 查看
出现这个问题可能是你看的 Butterknife使用列子是 8.0以下的

简单的说呢。就是之前只加了 compile ‘com.jakewharton:butterknife:8.0.1’

简解决办法:

在你的android studio 不是 3.0版本的话

1.在build.gradlec(Project)中添加这个 :


lasspath 'com.neenbedankt.gradle.plugins:android-apt:1.8'


2.在build.grodlec(app) :
顶部添加


apply plugin: 'com.neenbedankt.android-apt'


然后在 dependencies{
添加这俩句


compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'


}
在编译一下就可以了


如果你的AndroidStudio 是3.0

只需要在 build.grodlec(app) 下添加俩句话就可以了:

compile 'com.jakewharton:butterknife:8.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐