In fact, Android own maintenance of this public final class R class is mainly with the new resource file, this R.java without our own to modify, if you do not understand do not modify it, it defines the value of each resource is unique, does not conflict with the system. This file is automatically updated by the ADT plugin, and when you edit the res file, the class is automatically updated.
R.java typically have attr, drawable, ID, raw, Layout, string, and XML, depending on the resources you use for your project. This needs to be rebuilt when the R.java file is lost, but there may be problems, such as resources not being updated automatically.
Solve
- 1
Select "Eclipse-myeclipse" clean, The R file will appear.
- 2
Click the right mouse button on the project, select "Build project" and R.java will reply. This allows you to invoke the resources that the r file points to in your program, and you can automatically complete it.
- 3
Copy an R file from another project, then change it in string.xml and clean it, or update the R file.
- 4
If none of the above steps are possible. It is possible that the project itself caused errors, such as the naming of files in Resoure resources, such as Result_main.xml, and if written result_main.xml is wrong, the resource file name needs to be all lowercase.
Source: http://jingyan.baidu.com/article/fc07f98917046f12ffe51929.html