There are many solutions to solve the Error "R cannot be resolved". We will discuss one by one here
1. After tracking down this problem as well, I found this note in the Android documentation:
*Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.*
While going through the Android sample tutorials, I would often use the Ctrl + Shift + Ocommand to "Organize Imports" and generate any missing import statements. Sometimes this would generate the incorrect import statement which would hide the
R.java class that is automatically generated when you build.
2. just clean and rebuilt your project it sometimes help
Make sure that there is no error in your res/drawable folder in android.While naming images in this folder don't give numbers and capital letters.
3. It worked for me with Right Click>Android Tools>Fix project properties and some time aftr restarting Eclipse.
4. Each time I had a problem with R not been generated, or even disappeared, this was due to some problem in the XML layout file that prevented the application from being built.
R is a generated class. If you are using the Android Development Tools (ADT) it is generated whenever the project is built. You may have 'Build Automatically' turned off.
In most of the cases this problem is occurs due to the xml designing
