The R.java file is an auto-generated file that contains references to all the resources used in a project.
Possible fixes for the error is:
Make sure that in ‘Eclipse IDE ‘–in menu item ‘Project’ -> “Build automatically” is checked.
Then ‘Clean’ your project and ‘Build’ it again.
Make sure that there are no errors in your XML files.