Almost every Android developer encounters this error once during their development . The error is related to R.java class not getting auto-generated on compilation of Android . Usually it is caused by some error in xml file or resource naming . At other times even though it is not the case Eclipse seems to add “android.R” import in your files .So this issues are usually solved by :
IF any error in xml file check and resolve that .
Make sure the naming conventions is followed in naming resources .
Then perform CLEAN your project. BUILD it and see R.java file is generate in gen folder .
At sometimes if above process does not work ; CREATE a R.java file in gen folder and CLEAN and again BUILD the project .This will result in warning however proceed and should get resolved.
The above steps will help you to resolve “R not defined ” or R not getting generated error .
Also if you happen to use Ubuntu and have 64 bit machine and even trying the above steps does not resolve the issue then it seems lib32 architecture libraries are not installed in your machine . Make sure you install them using :
sudo apt-get install ia32-lib
And restart eclipse and again generate the code and it should resolve the issue .