Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Hooking Up the Model to the View Using Butter Knife for Views

Unable to use butterknife annotations in code

I added the line in my gradle(module : app) file:

compile 'com.jakewharton:butterknife:6.1.0'

and synced gradle.

However, I am unable to view/use the '@FindView' annotation instead of the '@Inject' in 6.0.0 in MainActivity.

What do I need to do to make it work?

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

The Butter Knife page clearly states to use "@InjectView". The switch to "@FindView" is for a pending new release (7.0.0 I believe), or if you build Butter Knife from the latest source. That's why "@FindView" is documented on the GitHub repository but not in the release web page.

My issue was with the auto-import of Butter Knife classes. I had to do that manually for even '@InjectView' to show up in the suggestions, not sure why it was not importing automatically.