Friday, May 27, 2011

Android error: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/....').

I have been getting this error and I could not figure out what is the problem. Finally figured out the reason.

This error means that R.java does not have a reference to the image file in question.
Check R.java under gen folder and find out  if it has a location reference to the image file you added.  If it does not, these are the possible reasons.

1. You forgot to add image file to res drawable folder
2. You added image file to a wrong drawable folder. There are three drawable directories, namely
drawable-hdpi, drawable-ldpi, drawable-mdpi. Try to add image to all three directories and one of them will work depending on the resolution size of your image.


3.  You have another file in the folder with the same name. Rename one of them so that there are no name conflicts.










No comments:

Post a Comment