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

Jack Crane
Jack Crane
2,491 Points

ButterKnife - MainActivity - Cannot resolve symbol "TextView" & "ImageView"

I think this may be a problem with the Gradle import I did itself, but I'll get onto that..

Firstly, when I went to the ButterKnife download part of its github page, I added all the download code it said into my Project and Module gradle files, after doing this it would give me an error of "Grade DSL method not found: apply()"

So after I take out all of the code and just enter..

compile 'com.jakewharton:butterknife:8.0.1'

The file now says it cannot resolve the TextView and Imageview in my main activity.

What can I do?

Screenshots provided...

http://www.jackcrane.co.uk/tth/1.png

http://www.jackcrane.co.uk/tth/2.png

Project file...

http://www.jackcrane.co.uk/tth/Storm.zip

3 Answers

Seth Kroger
Seth Kroger
56,413 Points

First see this post about configuring the current ButterKnife in gradle: https://teamtreehouse.com/community/more-deprecated-butterknife-code

Second, did you change anything the the Project's gradle file? I notice you have it open on a tab.

Jack Crane
Jack Crane
2,491 Points

Yes I have already looked at that post.

I've added my project file for you to look at if need be - I added the project grade code as instructed in the download section on github..

Add this to you project-level build.gradle:

buildscript {
  repositories {
    mavenCentral()
   }
  dependencies {
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
  }
}