• Advertisement
Sign in to follow this  

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

This topic is 2486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement