Android / Eclipse "R cannot be resolved to a variable"

Started by
0 comments, last by SriLumpa 13 years ago
Trying to learn Android, I've downloaded some of the provided example open-source games to have a look at the code and try to mess around with them a bit. I got the source for Snake and a couple of other simple games from the developers wiki, but I cannot get any of these projects to work in Eclipse. After having imported them, if I try to build them I get a ton of 'R cannot be resolved to a variable' errors. After having Googled this error, it appears that it is usually caused by Eclipse adding an incorrect import to files containing resources...

http://stackoverflow...d-android-error

...but after having searched every file in the created project I can't find this import line that in theory causes this error. I don't know what else to try, but I'm entirely new to Android and I'm sure the solution must be very obvious to anyone who has a clue...?

Thanks
Advertisement
R is an auto generated class. Do you have the Android plugin installed, is your project an Android project, and did you activate automatic build ?
If so you should have R.java in some folder named "gen". If not, look again at that Stack Overflow post, many possible solutions to that are mentioned there.

This topic is closed to new replies.

Advertisement