No generated R.java file in my project [duplicate]

Go to Project and hit Clean. This should, among others, regenerate your R.java file.

Also get rid of any import android.R.* statements and then do the clean up I mentioned.

Apparently Jonas problem was related to incorrect target build settings. His target build was set to Android 2.1 (SDK v7) where his layout XML used Android 2.2 (SDK v8) elements (layout parameter match_parent), due to this there was no way for Eclipse to correctly generate the R.java file which caused all the problems.


After one whole day trying to find why R file was not generated, I found that after install Android SDK Tools r22 a new option in Tools was available: Android SDK Build Tools.

After installing it R file was generated again.


now you have imported android.R instead of your own R... Try to take a look on your "problems" view if you have errors in one of your xml files... get rid of the import android.R and comment out all usages of R.*

Cleaning should help when your project has no other errors, so check your xml files or file naming in your res folders


Probably u might be using a incorrect SDK version. Right click on your project. Select Properties-->Android. Note that 2.2 is the latest SDK. Check it and see if it gets compiled...

Edit

Also Do a clean after that


I Had a similar problem

Best way to Identify this problem is to identify Lint warnings:: *Right Click on project > Android Tools > Run Lint : Common Errors*

  • That helps us to show some errors through which we can fix things which make R.java regenerated once again
  • By following above steps i identified that i had added some image files that i have not used -> I removed them -> That fixed the problem !

Finally Clean the project !