- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用 this library project ,所以我尝试运行示例应用程序(在 Github 链接的 /app/source/main/
中),在 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 版本包含重命名注释动词的重大更改。这在变更日志中突出显示并反射(reflect)在网站中。
Version 7.0.0 *(2015-06-27)*
----------------------------
* `@Bind` replaces `@InjectView` and `@InjectViews`.
* `ButterKnife.bind` and `ButterKnife.unbind` replaces `ButterKnife.inject`
and `ButterKnife.reset`, respectively.
...
关于android - import butterknife.InjectView 无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31531475/
tl;博士:在单元测试中,@Inject成功注入(inject)所需字段,但 @InjectView将它们保留为空,从而导致错误。 @InjectView在正常的应用程序运行中工作。 我有一个使用 R
我正在尝试使用 droidParts,特别是 DI 部分。我正在测试 2 个注入(inject),InjectResource 和 InjectView,但第二个似乎不起作用。 我有一个带有 text
我正在尝试在我的 Android 应用程序中使用 @InjectViews 但这似乎不起作用。这是它的代码。我已将库和 jar 包含到我的 android 应用程序中,并直接从 RoboActivit
Activity 中用 @InjectView 或 @InjectResource 注释的字段究竟何时被注入(inject)? 最佳答案 根据 A Simple Example在 Roboguice
所以我对这个 Activity 有不同的布局。 我有不同的类,每个类都打开并使用布局做他们的事情。 我通过@Inject 在 Activity 中注入(inject)这些类。这一切都没有问题。 但是当
我正在尝试使用 this library project ,所以我尝试运行示例应用程序(在 Github 链接的 /app/source/main/ 中),在 MainActivity.java 中,
@Inject 的含义和目的是什么 和/或 @InjectView Android/Java 编程中的注解? 我该如何使用它? 提前致谢! 最佳答案 对于 Android,这些注释是 Roboguic
我正在使用 butterknife 库。我不太了解如何使用它。我发现 injectView 和 bind 做同样的事情,但我不太确定。任何人都可以解释这两者之间的区别。 最佳答案 谁能解释一下这两者的
我正在使用 @InjectView 来处理我的许多 View 。在我更新到最新版本 7 后,它们停止工作了吗?发生了什么事? 最佳答案 您遇到这种情况是因为 Butterknife 版本 7 具有一组
我在整个项目中采用了 @InjectView 主题,并且在压缩这些声明时遇到了一个小问题。在我输入初始代码后,它在一行中看起来很棒...... @InjectView(R.id.tv_report_s
我在我的项目中收到了这个警告。我正在学习使用 IntelliJ IDEA 作为我的 IDE。 这是带有警告的代码: @InjectView(R.id.button) private Button lo
最近刚接触到 butterknife。我在我的 gradle(module : app) 文件中添加了这一行:编译 'com.jakewharton:butterknife:7.0.1' 它同步没有任
我是一名优秀的程序员,十分优秀!