Yo, What Up?‎ > ‎

Missing Resource file in Eclipse

posted Feb 26, 2012, 1:55 PM by Ken Hunt
This is a weird little quark I encountered a couple times: Your project shows numerous errors. After a closer look, you discover that Eclipse does not recognize your resources. Example, you see an error indicator under the "R" in a line such as this,


If you check you will see there is no R.java file under your gen folder. One fix I found was to check your XML files under the res directory, you may have an error in some of the files. This can happen if you imported your project (I imported a project, but for some reason the string.xml files in my values directorys were old and outdated...I references strings that did not exist and the XMLs in the layout directory throw errors). The end result was that after the import, Eclipse didn't know how to build the resource file (or couldn't), so it wasn't and none of my resources were good.

My solution: correct the errors in the XMLs, hit Refresh (F5), and go to Project > Clean. This should allow Eclipse to rebuild the resource file.