Off the bat, version information:
- Eclipse: Juno Release, build 20120614-1722
- Android: 4.4
- ADT: 20.0.0v201206242043-391819
There are many, many questions on SO regarding the various res/drawable folders (standard, drawable-hdpi, -mdpi, -ldpi, -xhdpi) and on whether it’s necessary to create the standard drawable folder if it doesn’t exist, where Android/ADT/Eclipse will look for the @drawable/* files, etc. However, my question seems to not have been answered thus far.
It’s a pretty striaghtforward problem. To put it simply, I placed a file name ‘starbg.png’ in my drawable-hdpi folder, then used the qualifier @drawable/starbg.png in a layout xml file. However, Eclipse is throwing an error:
error: Error: No resource found that matches the given name (at 'background'
with value '@drawable/starbg.png').
Why? Unsure. I have tried the following solutions based on SO questions, all without success:
- Cleaning the project (multiple times)
- Creating a
res/drawablefolder (as one was not auto-generated by my version of ADT) and adding the image there - Copying the file into every single related folder
- Renaming the file to
star_bg.png - Restarting Eclipse
The project is not complicated. It’s an incredibly simple setup, with 2 views, one of which has nothing more than a LinearLayout with an android:background attribute (with layout and orientation info, of course), the other of which works like a charm.
So I’m stumped. Any help is hugely appreciated.
when you specify your resource, it should not include the file extension. that is, a resource file,
should be referenced as,
e.g.,