I know this question has been asked before but I am at my witts end with this. I have just created a new project and getting this error.
Ofcourse the R.java file is not
If you have any errors in your resource files, the tools will not generate an R.java file. Look for and fix all errors in the .xml files before worrying about class com.example.myfirstapp.R
not being defined. If you have no errors in the .xml files, then clean and rebuild your project.
Also, just to rule out a programming environment problem if you're using Eclipse, right-click on the project name in the Package Explorer, navigate to Android Tools and select "Fix Project Properties".