Every time in code that I have an R, I get an error R cannot be resolved to a variable.
The R.java file appears to be missing.
I have tried cleaning the project.
This can happen when you have an error in one of your xml files (for example, a resource cannot be found). This can also happen because of using menus (I have had this problem because of menus, and I had to remove them, clean and add them again). And another possible reason is that you initially wanted to have your R class not in the default place where it is created but in your own package. So it is possible that R is created in its default location and your program is looking for it somewhere else.
2.1m questions
2.1m answers
60 comments
57.0k users