In Android development, the R class is an automatically generated class that is placed in the Gen directory and is responsible for managing resources in the application. R file error is a very common problem, below to summarize why it is error and how to deal with errors.
First say why the error:
Just said, this class is responsible for managing resources, so it is in addition to the error, first you have to check whether your resource files are correct, that is, your res folder of things. There are many causes of resource file error, often encountered such as, the layout file name capital, copy when the same ID generated the view ... After you have ruled out these issues, try the following steps in turn if you are not OK:
1. Re-check the validity of XML in the resource file
Although the above analysis of the reasons for the time said once, but the important thing is to say more, again, remember to beat themselves.
if the last compile time is not generatedR.javafile, the project resource reference error is raised. Typically, this is by layoutXMLcaused by a spelling error in the file. Because the layout cannot be verifiedXMLthe validity of the document,Eclipseinput error alerts are often not available. Fix bugs and saveXMLfiles,Eclipsewill regenerate the newR.javafile.
2, Cleanup project
Select the project--clean menu item. Eclipse will recompile the entire project, eliminating errors.
3, run Android Lint
Select Window---Run Android Lint menu item. Lint will check and comb the project resource files.
4. Delete Gen Directory
ifEclipseunable to generate a newRfile, we can delete the entireGendirectory. Eclipsewill recompile the project and create a newGenfile with full-featuredRfile.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
android--processing R file missing or error problem