Like many Android developers/hobbyists, I use ADT as my IDE – the price is right. It was only a matter of time before I ran into the well-documented, or at least well-complained, instance of R.java not auto-generating in ADT.
R.java basically keeps track of your resources so you can reference them in code through R-dot-whatever. The idea of R.java makes sense. No complaints there. The problem is when R.java, which is supposed to be generated and refreshed as you add resources, does not refresh. Doing a Project > Clean apparently makes it go away when you have problems and, when it doesn’t come back, your code is full of angry, red markers.
This happened to me.
A quick search led me to Stack Overflow, which then led me to this person’s page.
After reading that, I went straight to my res directory and started inspecting files. Two minutes later I had found the culprit: a reference in a menu to a string resource that didn’t exist. Okay, my bust, but what a harsh penalty.
If you’re having this problem, go check your resources first. Make sure everything ticks, ties, and there are no orphaned references. Hopefully that fixes it for you and hopefully you find the issue quickly.
My final thought on this is that with so many comments online, it seems like this is a common enough hiccup that a more graceful solution should be built into ADT. The tool tips that pop up on an empty R reference seem like a logical place to prompt the developer to double-check resources and mappings.