我试图使用
this library project,所以我尝试运行示例应用程序(在/ app / source / main /在Github链接中),在MainActivity.java中,我收到导入错误
import butterknife.InjectView;
而且在MainActivity.java和VerticalLinearRecyclerViewSample.java中,每次出现@InjectView(…)注释时,都会出现以下错误:
InjectView cannot be resolved to a type
那我该怎么办呢?
我做了什么:
我见过this question.没有为我工作,在那里发表评论.
我有followed these steps to include the Butter Knife library到第3步.关于步骤#4,“确保.apt_generated /文件夹位于项目根目录…” – 此项目没有任何名为.apt-generated的文件夹或项目根文件夹中的内容.
注意:我实际上使用Eclipse,而Github上的项目是针对Android Studio的,因此我在eclipse中创建了一个新项目,并从下载的Android Studio项目中复制了单个文件.我希望这没有什么不同.
解决方法
感谢@Sharj首先回答.
Butterknife 7.0.0版本包括重命名注释动词的重大变化.这在更改日志中突出显示并反映在网站中.
Version 7.0.0 *(2015-06-27)* ---------------------------- * `@Bind` replaces `@InjectView` and `@InjectViews`. * `ButterKnife.bind` and `ButterKnife.unbind` replaces `ButterKnife.inject` and `ButterKnife.reset`,respectively. ...
https://github.com/JakeWharton/butterknife/blob/f65dc849d80f6761d1b4a475626c568b2de883d9/CHANGELOG.md