Recently began to learn the development of Android, after the configuration of the development environment, the creation of the first Android project in the cannot is resolved to a variable error, that is, the R file can not generate problems.
here's how to find the solution from the Web:
Android development process, encountered R cannot is resolved to a variable error message, as if there is no very certain wrong reason, generally speaking, I summed up a few possible solutions, I hope to try to work later ...
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
10. Restart your computer to prevent problems with your Android virtual machine
As a result of the above problems caused by not making any changes since the creation, it is considered an SDK or ADT problem, and then upgrade it, but after the upgrade or not, and then remove ADT Reinstall, during the period also downloaded a others packaged Android development Kit, including the SDK, After the configuration is complete or not. The situation had been bulging for two nights and the realization did not understand where the reason was. Finally, after copying a new Eclipse and SDK program from a colleague of the company's Android developer, reconfigure everything OK.
Looking back on these two days, the main reason for this problem is that the SDK is having problems.