Gray's comment is a good summary of the most common causes to this problem, including resource file naming convention, the erroneous "import Android. Make sure that Android Private Libraries is selected. Check the link below Eclipse error: R cannot be resolved to a variable Whenever your generated R class isn't generated, it indicates that there's a problem with generating it due to some parsing issue from the XML resources.
R" statement, XML errors, corruption requiring cleaning and rebuilding, and checking the Android SDK in Project - Java Build Path / Libraries. The only remaining possibility within Gray's list seems to be that either my or Android is broken, so I have included them to make sure I didn't miss any errors. If so follow the below Right click on your project goto properties. Check the error console in your IDE to figure out what's specifically wrong.
So does a new project, as long there is no change needed in the file.
Please somebody has some hints and ideas where to look next please?open the "problems" window in eclipse, if there are any issues in any of the xml files, will not generate.if there are single quotes in the xml files, they should be replaced with double quotes.I downloaded revisions - 21.1.1 and 17, but still not working.I am running Eclipse 4.2.2 Juno on Windows 64-bit for development on Android SDK 17 with ADT. Some of the layout_heigh/width attributes were set to "match_parent" which is not a valid value, they're supposed to be set to "fill_parent". Not sure how it got that way, or the correct way to fix it, but I basically copy/pasted from a working project and got building again. I was having the same issue and I finally realized the issue was in the "note_edit.xml" file.I copy pasted it from the previous projects but the current project is still giving errors. it is saying that building workspace has encountered a problem, errors occurred during the build, the error is null pointer exception. Just check whether have you installed the 'SDK build tools'. 4) Even if its not working then create a new project and place all Source and resource files from Earlier to this one.The fact is that probably you're missing the Android Build tools. If you already updated the SDK tools, re-open the SDK manager and check under the "Tools" section that "Android SDK Build tools" are installed and eventually, update them. and also check whether did you update necessary sdk packages and specially the android tools to the newest version. This problem generally occurs when you update SDK manager but it's not permanent.Doing this fixed my issue and all the build errors disappeared.Recently i updated the eclipse software and when i started doing new projects, the file was missing. This is my SDK manager when i am cleaning the project and building it again, it is giving me an error. If you are using a higher version of the android sdk.