James McP James McP - 10 months ago 65
Android Question

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 clean, rebuild, sync, invalidate cache & restart solutions for the error. Only if i delete the files can I get the build to pass.

I am not sure what is wrong here.

Note: I am on Android Studio 2.1.1


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..!!