Image in drawable but still getting error

6.2k views Asked by At

So I keep running into this error for my ImageView even though I have copy/pasted the image into my drawable folder and have called it in my ImageView XML Code:

    <ImageView

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/home_screen" />

What am I doing wrong?

6

There are 6 answers

0
Kamila Brito On

Nothing appears to be wrong so try to rebuild and refresh your project. Maybe close and reopen your android studio.

0
Skizo-ozᴉʞS ツ On

As I can see nothing is wrong with your code, so try those steps that I give to you:

1.- Remove the home_screen.png from your Drawable folder.

2.- Clear / rebuild project ( even if you want you can restart your IDE )

3.- Try it again, copy and paste the image to your Drawable folder

0
Álisson Morais On

I don't know for sure if this could help you, but once it happens to me. IDE wasn't showing an error that I did when wrote one Class. After reading the whole code, I could found and fix it.

After that R class was updated and the resource was found.

0
Baris On

Your drawable document would be in v24 drawable file. Move it to normal drawable file. You can move in project section.

0
Arpan Saini On

File name in the drawable folder in android studio. Must follow the below naming convention. After changing capital letters to small letters to my file name. it resolved the problem

File-based resource names must contain only lowercase a-z, 0-9, or underscore

0
Fatih İnci On

Delete all xml style docs. And add again xml docs. But create new drawable file. And don't copy paste xml file. just add new drawable file. I fixed this issue this metod.