Android development process, encountered R cannot is resolved to a variable error message, from the Internet searched a bunch, found no matter use as follows: Finally resolved, here to make a record, online summary of the following:
1. Check if the Android SDK is missing and need to download again, check the build path
2. Ensure class does not have import ANDROID.R;
3, error class refers to the layout of the XML file without errors
4. Check the Androidmanifest.xml file, inside the package,layout configuration file, Strings.xml and other strings are all written correctly
The string in the Strings.xml referenced in the 5.layout XML file is spelled exactly correctly
6. In the layout of the XML file to add a control handwriting to see if the ID can be automatically generated in R.java, if not, it is very likely that the layout of the XML file is a problem, to see whether the format is used correctly, or contain any illegal string, or call to an incorrect string, And so on, you can use the exclusion method to remove the control, until you find that the error message disappears or the ID can be automatically generated in R.java.
7. Delete the Gen folder, make the R.java auto-generated once, if not, continue to check the layout of the XML file is not easy to find the problem
8.Clean project, re-build, or re-import project.
9. Restart Eclipse
My mistake appears and the above is not the same, the following post my question:
My reason for the error is this, I downloaded a few PNG images from the Internet, directly into the resource file, the beginning of the time has not been a problem, I hand a cheap click on the project clean, Then R.java file is lost, in accordance with the above problems collected by netizens, I checked once and again, found not the above reasons, and finally see the error output, found that the problem lies:
This is the file name that you put in the resource file does not conform to the specification:
Standardize the name, OK!!
Android r file lost build failed