I encountered this problem when I was making a new project on my eclipse workspace. I got a red underline on "R" in this part of my code
setContentView(R.layout.main);
So here's what I did to fix this issue. Go to Project Properties > Java Build Path > Tick Android Version Checkbox
![]() |
| Click to enlarge. |
Then if your workspace does not build automatically…
Properties again > Build Project
After that, all went back to normal. :)
For FREE programming tutorials, enter your email below and subscribe! :)




6 comments:
Resolving R error: I in general try to save, debug or run again n again to remove this error....nice solution :-)
Thanks for your suggestion and comment Anonymous :)
Great tip. Ticking the Android checkbox fixed the problem. Thanks!
You're welcome @Anonymous. :)
wow... Finally it worked thanks you are genius.
(Yesterday i updated my eclipse version into Juno and also the android sdk to 4.1 after that i was facing the 'R cannot be resolved to a variable' problem)
But now its Absolutely Fine..
:) thanks :)
though that is a great solution. it did not work for me.
Post a Comment
You can use http://pastebin.com/ or http://jsfiddle.net/ if you want to comment some codes.