Eclipse not recognizing R generated ints


Until now, Eclipse has been working just fine. However, when I try to inflate my view with a layout and then set my buttons and textview, I cannot find them when writing:

My file is generated and shows up under the “gen” file, and so far I’ve tried cleaning my project, making sure the “Build Automatically” option is checked (it wasn’t but then I turned it on and restarted Eclipse), and retyping my strings. (Chapter 33, which I’m on, says to import the XML file from the solutions, which is what I did by dragging and dropping).

Does anyone have suggestions as to what I should do to fix this?

Thanks in advance!


Make sure you haven’t inadvertently imported android.R.


Thanks, worked like a charm! Can you explain how I did this because it I haven’t had such a problem before?


Importing android.R by mistake is very easy to do - it happens to me sometimes, too. All you have to do is Organize Imports while your files has failed to generate (like e.g. if you’ve made a mistake in your resources somewhere).