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 (2014) Improving Our Code Simple Refactoring: Using a Class

Steve Kinsey
Steve Kinsey
4,463 Points

Cannot resolve symbol 'R'

Just finished making changes to FunFactsActivity and FactBook Java files but in FunFactsActivity.java three separate errors are appearing on the letter R (example the 'R' in setContentView(R.layout.activity_fun_facts); is red and says Cannot resolve symbol 'R' in a pop-up. I have no idea what I did to cause this nor how to rectify it...can anyone help? Cheers Treehousers :-) Steve

2 Answers

Hey Steve! Have you tried cleaning and rebuilding your project?

Steve Kinsey
Steve Kinsey
4,463 Points

Hi Kristen.

Yup, tried everything, even voodoo...but no joy so I just reverted the code back to the way it was at the end of the previous video and got past it that way.

Now having issues with my emulator stooping and telling me 'Unfortunately, Fun Facts has stopped' :-(

Grrrrr

:-)

Cheers, Steve K

Sean Gallagher
Sean Gallagher
2,054 Points

I was having the same issue where cannot resolve symbol R. I noticed my R file under build/source is missing.

I had build errors (because my layout had a missing ID attribute - ugh!) that I eventually saw in my messages window but not showing as red in XML text.

I did a clean and rebuild and it fixed the issue. So try checking to see if you have error messages.

Steve Kinsey
Steve Kinsey
4,463 Points

Thanks man...but already got past it thankfully :-)

Appreciate it though brother...

Peace steveKinsey