Recover the R.java file

dilipkaklotar picture dilipkaklotar · Mar 10, 2011 · Viewed 15.3k times · Source

While compiling my project, I lost my R.java file.

I recreated the new project and replaced all my .xml files, .java files, and all my images in the project, but in that project I also lost my R.java file.

What should do to solve this problem? Can I recreate my R.java file for the project?

Answer

Pascal MARTIN picture Pascal MARTIN · Mar 10, 2011

The R.java file is automatically generated by the Android tools ; so, you should always be able to re-generate it.

In this kind of case, forcing a clean and full-rebuild of the project generally helps.

In Eclipse, try :

  • Project > Clean
  • And choose to clean your project.