In my drawable folder I have a few images and they all reference perfect, but when I try and add any more images with the exact same size in the same folder, and try to refe
Restart Eclipse (unfortunately) and the problem will go away.
I think I found a way to have it work without restarting Eclipse, or without closing project (it worked for me):
rename image file name under res/ in Eclipse -> choose file and press F2 (for me it res/drawable-mdpi/bush-landscape.jpg -> changed to bush.jpg)
Build Project (it will still show error)
change image where you used it (I changed in Graphical Layout. For me the place was LinearLayout/Background/bush-landscape -> changed "bush-landscape" to "bush")
Build Project
It can be even more trivial than what the other posters suggested: if you have multiple projects make sure you did not create the xml layout file in the wrong project.
After creation, the file will open automatically so this might go unnoticed and you assume it is in the correct project. Obviously any references to drawables or other resources will be invalid.
And yes, I am that stupid. I'll close any unused projects from now on :)
Simplify the name of your file, seems to be that any special characters in the file name makes it hiccup. for example chaange "my-main-header.png" to "header1.png" not sure why, but it works
For Android Studio I had this same problem. It was caused by running from linux, meaning the files did not automatically receive an extension. By manually adding .png to the end of the filenames it could recognize the filetype and load accordingly.
Android studio might throw a hissy fit if you try to refactor rename inside the project, because android will try to regenerate R immediately. I do not know exactly what causes the error as it points to some seemingly random line of code, which in my case was a comment.
Solution to that: Delete from drawable, rename outside of the project and throw them in again.
In my case I had an image in different folders (with same name) for supporting different dpi and device sizes. All images had same name except one of them. It was mistyped and once I renamed it like other names, it resolved my issue.