I ran into the dreaded "R cannot be resolved to a variable" error after doing a Project > Clean. I tracked the problem down to my main.XML file (wasnt the typical import.R in the java) . It was giving an error along the lines of "error parsing XML" at the end of my LinearLayout. To fix it I had to clear out all the code in my main.XML, save the changes, then retype it. That fixed the R cannot be resolved. However, my buttons are no longer visible in either the graphical layout image or while running on a device. I have an edittext at the top which is still visible, but the buttons below it no longer show up. Project > Clean doesn't fix it, exiting and restarting Eclipse hasnt fixed it, typing in a harmless string or adding another button and saving hasnt fixed it. My gen file is there, and its showing the layout. Thoughts on where else to look?
Asked
Active
Viewed 91 times
0
-
Related: [R cannot be resolved - Android error](http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error) - [“R cannot be resolved to a variable”?](http://stackoverflow.com/questions/7824730/r-cannot-be-resolved-to-a-variable) - [Google Search: site:stackoverflow.com r cannot be resolved to a variable](https://www.google.dk/search?&q=site:stackoverflow.com+r+cannot+be+resolved+to+a+variable) - [StackOverflow Search: r cannot be resolved to a variable](http://stackoverflow.com/search?q=r+cannot+be+resolved+to+a+variable) – Aske B. Sep 15 '12 at 13:38
-
Sorry, I was a little too quick there. I'm not sure your issue has much to do with the fact that it occurred after having the "R cannot be resolved to a variable" error. These might help though: [Button not displaying in LinearLayout](http://stackoverflow.com/questions/6939215/button-not-displaying-in-linearlayout) - [Google Search: site:stackoverflow.com button not showing android](https://www.google.dk/search?q=site%3Astackoverflow.com+button+not+showing+android&oq=site%3Astackoverflow.com+button+not+showing+android). If not, try posting your XML. – Aske B. Sep 15 '12 at 13:58
-
Second set of links did the trick, much appreciated. Was just coincidence it happened after the R problem, was barking up the wrong tree ;-) – user1409172 Sep 15 '12 at 14:16
1 Answers
0
Aske B. answered the question for me with the links he provided, there was a problem in the the XML.

user1409172
- 97
- 1
- 11