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 Android Lists and Adapters (2015) Lists with RecyclerViews Adding Methods for a RecyclerView Adapter

Problem with losing import of R class

Not really a question, but I ran into a problem that other might face. I had an error in one of my xml files that was pretty well hidden (I wrote layout_alignCenterVertical instead of layout_centerVertical) and when i did the clean and rebuild that Ben suggested in this video, it caused the R class import to be unrecognized in all of my classes.

So if you have this problem, you probably just have an xml error, just fix it and rebuild.

2 Answers

David Anton
PLUS
David Anton
Courses Plus Student 30,936 Points
  1. Fix your xml syntax error
    1. Clean
    2. Rebuild
    3. Restart Android Studio
Gnani Pasupula
Gnani Pasupula
3,915 Points

Go to File on Top right corner > Invalidate Caches / Restart > Invalidate and Restart. It worked for me .