Skip to content Skip to sidebar Skip to footer

After Add Images To Drawable "cannot Resolve Symbol R" Issue Not Going Away After Clean, Rebuild Etc

I can't find a way to add images to drawable folder without getting 'Cannot resolve symbol R' issue. And once i get 'Cannot resolve symbol R', I can't get rid of it by either clea

Solution 1:

I had exactly the same problem, and it was that I downloaded an "image.jpeg" extension from Internet and directly changed the extension saving it like "image.png", but Android studio still recognized it like image.jpeg.

I realized that when using top menu Analyze-Inpect code.

Once the inspection is finished a new window called 'Inspection' appears and in the follow carpets appears next:

Android > Lint > Usability > Icons
Icon format does notmatch the file extension

     Misleading file extension; named .png but the file format is JPEG*

Solution 2:

You are facing this issue because your drawable file name is either having any capital letter or starting with a number or containing any special character like @,*,$ etc. rename it the error will be gone.

You can use only small letters, underscore(_), numbers(not at beginning) & dot(.) in the name of drawable

For example the name could be ABC.png then rename it to abc.png and it will work.

1xYz.JPEG then rename it to _1xyz.jpeg

a@b.png then rename it to ab.png

After that clean and rebuild & there you Go..!!

Solution 3:

I found that the extension of the file must match the actual format of the image.

For example, you will get this error if you changed the extension of an image from bmp to png and added it to the project

Post a Comment for "After Add Images To Drawable "cannot Resolve Symbol R" Issue Not Going Away After Clean, Rebuild Etc"