问题
My problem is that eclipse
is not generating a R.java
file even right after creating a new android application project so there should be no errors in my xml
files.
I double checked to see if there was any errors with the xml
files. Also I have cleaned and rebuilt my project manually.
I'm using eclipse 3.7
and adt 20.0.3.v201208082019-427395
Edit: Here is a screen from eclipse
回答1:
If you think that your layout xml and manifest.xml is correct than might be your Android plugin is corrupted. Try to re-install the ADT plugin. It happened to me once. Thanks.
回答2:
1. First Clean your Project, from Project ---> Clean.
2. Check is there any Error in the xml file.
3. Never import android.R
////// Edited ///////////////
Go below in your Problem tab
....
Delete all the Errors in it, and also delete all the Warnings....
I am showing the warning deletion
回答3:
I had this problem once. In my case, the problem was the workspace. Just create a new workspace in Eclipse and try creating a new project. It worked for me.
回答4:
You did confirm you don't have the line "import android.R" in your source right? I had that happen to me early on and the only way to fix it was to know to manually delete that import line.
回答5:
I encountered the same problem yesterday and finally solved it. Especially the problem arouse when restarted the IDE. Because the R.java will be regenerated when project reloaded. I try to clean the project and rebuild. But no luck. If you indeed are sure that the layout xml is correct, you can try to delete the project and reimport it. BTW, I found the Google adt bundle which is a android development IDE provided by Google has no R.java missing problem. The same source in eclipse+adt_plugin always has the R.java missing problem. But the same source did not has the problem in adt bundle.
来源:https://stackoverflow.com/questions/12048988/eclipse-3-7-android-r-java-missing