Import butterknife.InjectView cannot be resolved

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 get an error while importing

 import butterknife.InjectView; 

as well as in MainActivity.java and VerticalLinearRecyclerViewSample.java , every time the @InjectView(...) annotation @InjectView(...) I get the following error:

 InjectView cannot be resolved to a type 

So what should I do with this?


WHAT DID I SAY:

I saw this question . Did not work for me, left a comment there.

I followed the steps to enable the Butter Knife library up to step # 3. About step 4: "Make sure that the .apt_generated / folder is at the root of your project ..." - this project does not have a folder named .apt-generated or what something in the root folder of the project.


Note: I really use Eclipse, and the project is in Github for Android Studio, so I created a new project in eclipse and copied individual files from the downloaded Android Studio project. I hope this has not changed the situation.

+6
android eclipse butterknife
source share
3 answers

Credit @Sharj for an answer first.

Butterknife 7.0.0 introduced a violation of the renaming of annotation verbs. This is highlighted in the change log and reflected on 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

+23
source share

The latest version has bind instead of InjectView . The version before that uses ButterKnife.inject(this) to enter the view. In addition, Eclipse is no longer supported, start using Android Studio.

+6
source share

Change ButterKnife.inject (this); to ButterKnife.bind (this);

0
source share

All Articles