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 Simple Android App (retired 2014) Getting Started with Android Accessing Views in Code

I don't know what else to do

I keep getting the following error but don't understand what it means.

./com/example/crystal/ball/MainActivity.java:18: cannot find symbol symbol : method findViewyById(int) location: class com.example.crystal.ball.MainActivity Button getAnswerButton = (Button) findViewyById(R.id.button1); ^ 1 error

3 Answers

Paul Stevens
Paul Stevens
4,125 Points


You have a spelling mistake in this line of code

Button getAnswerButton = (Button) findViewyById(R.id.button1);

It needs to be findViewById, you have an extra "y" after the word "view" It should be as below:

Button getAnswerButton = (Button) findViewById(R.id.button1);

Hope this helps. :D

Man, that was so frustrating...I just kept looking at it with overflowing frustration but never saw that stupid extra Y. Thank you so much!!!!

That error means that a method or variable isn't declared.. Make sure you have all the necessary imports, and that your MainActivity class extends Activity. If you're in Eclipse, you can organize imports with ctrl + shift + o. Your MainActivity class declaration should be

public class MainActivity extends Activity
Paul Stevens
Paul Stevens
4,125 Points

More than welcome, they are the worst, because it looks fine if you read it yourself, and it makes no sense why it won't work, I have fallen foul of that so many times.

Glad I could help. :D