导入黄油刀.InjectView无法解决 [英] The import butterknife.InjectView cannot be resolved

查看:848
本文介绍了导入黄油刀.InjectView无法解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用这个图书馆项目,所以我试图运行在Github链接中的示例应用程序(位于 / app / source / main / )中,在 MainActivity.java 中,导入错误

I am trying to use this library project, so I tried to run the sample application (in /app/source/main/ in the Github link), and in MainActivity.java, I am getting the error on the import

import butterknife.InjectView;

以及 MainActivity.java code> VerticalLinearRecyclerViewSample.java ,每次出现 @InjectView(...)注释时,我收到以下错误: p>

and also in MainActivity.java and VerticalLinearRecyclerViewSample.java, at every occurance of @InjectView(...) annotation, I get the following error:

InjectView cannot be resolved to a type

那么该怎么办?

我是TRIED:

我看过这个问题。没有为我工作,在那里留下评论。

I have seen this question. Didn't work for me, left a comment there.

我有按照以下步骤将Butter Knife库包括到步骤#3。关于步骤#4,确保.apt_generated /文件夹在您的项目根... - 此项目没有任何名为 .apt生成的文件夹或项目根文件夹中的某些东西。

I have followed these steps to include the Butter Knife library till Step#3. About Step#4, "Make sure that the .apt_generated/ folder is in your project root..." - this project does not have any folder named .apt-generated or something in the project root folder.

注意:我实际上使用Eclipse,Github上的项目是针对Android Studio,所以我在eclipse中创建了一个新项目,并从下载的Android Studio项目中复制了单个文件。我希望这没有什么区别。

Note: I actually use Eclipse, and the project on Github is for Android Studio, so I created a new project in eclipse and copied individual files from the downloaded Android Studio project. I hope this does not made a difference.

推荐答案

信用@Sharj先回答。

Credit to @Sharj for answering first.

Butterknife 7.0.0版本包括重命名注释动词的突破性变化。这是在更改日志中突出显示并反映在网站中。

The Butterknife 7.0.0 release included the breaking change of renaming of the annotation verbs. This is highlighted in the changelog and reflected in the website.

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

这篇关于导入黄油刀.InjectView无法解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆