Recently my android program won't generate the auto-generated R.java file under gen in my android project. I tried doing Project->Clean and it still doesn't work. I also restarted eclipse multiple times.
Any Ideas?
Make sure you don't have any errors* under your Problems tab in Eclipse. Try to use Fix Project Properties under Android Tools when your right click on your project.
If that doesn't fix your problem, try modifying your AndroidManifest.xml
(just add a space and save). I've heard that will force the R.java
to rebuild.
* except for errors that says R cannot be resolved to a variable - these errors will go away once you correct other errors and force R.java
to rebuild.
Check to see if you have any errors in any of your resource XML files. If you do, comment out the problem area, clean and rebuild. If you then get your R.java to autogenerate focus on trying to figure out what caused that XML error.
Since I am unable to improve the accepted answer due to persistent peer review rejections, I will have to post my proposed changes to the accepted answer as a separate answer.
Credits for first two paragraphs go to the user Haphazard.
Make sure you don't have any errors* under your Problems tab in Eclipse. Try to Fix Project Properties under Android Tools when your right click on your project.
If that doesn't fix your problem, try modifying your AndroidManifest.xml
(just add/remove a space and save). I've heard that will force the R.java
to rebuild.
* except for errors that says R cannot be resolved to a variable - these errors will go away once you correct other errors and force R.java
to rebuild.
I had this problem. I updated Android SDK and Eclipse. After a clean R.java reappeared.
精彩评论