Issue
I know this background image exists and it's in the following drawable folders:
- res/drawable-mdpi/
- res/drawable-hdpi/
- res/drawable-xhdpi/
- res/drawable-xxhdpi/
The file is named coming_up.9.png
as it's a nine patch and I know this works because I'm doing the same with a number of other images.
Layout XML
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/coming_up">
The Error
Error:(213, 37) No resource found that matches the given name (at 'background' with value '@drawable/coming_up').
Solution
I've been dealing with this issue for a while now and I decided today was the day to tackle it. Here's how I solved the problem:
Steps I Took:
- Changed background to a different (working) image named
@drawable/checkbox_checked
to see what would happen - app ran fine with the new image - Searched for
checkbox_checked
in my resource folder/res
to see where it existed - Found that
checkbox_checked.png
was only in the main/drawable
folder - Copied
coming_up.9.png
to/drawable
from/drawable-mdpi
- still the same error - Renamed
coming_up.9.png
tocoming_up.png
- worked - Renamed
coming_up.png
back tocoming_up.9.png
- still worked - Removed
coming_up.9.png
from/drawable
while leaving it in all of my other drawable folders - worked
Seemingly this is a bug with Android Studio that was somehow resolved at step #5. Regardless this issue is solved so I hope this saves someone the time it took me to figure it out.
Answered By - Jacksonkr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.