ButterKnife:“Error:Could not find method apt() for arguments ...”

来源:互联网 发布:弹弓专卖店淘宝网店铺 编辑:程序博客网 时间:2024/05/29 10:58

使用jakewharton大神的”黄油刀”替代“findViewById”时一直报空指针找不到控件

结果发现自己在build.gradle中少加了

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

之后sync报错:Error:Could not find method apt() for arguments [com.jakewharton:butterknife-compiler:8.0.1] on project ‘:mypracticeapp’. 意思是没找到apt方法,好尴尬,使用个框架都这么多错简直太弱了。。原来是在gradle文件中少了添加插件这么一句话

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

OK问题解决

总之,用别人的框架,应注意以下几点

添加插件
添加仓库、依赖

Over~

阅读全文
0 0
原创粉丝点击