“Failed to convert @ drawable / XX into a drawable exception details are logged in window”

Problem description

Image resource reference error, there are usually the following similar error logs:

java.lang.NumberFormatException: Color value 
'@drawable/xx' must start with #


The most likely cause of this problem is that your image resource name is wrong, and it is likely to start with a number. In Android, if your image is named after a number, the system will treat it as a hexadecimal color value by default, and the definition of these color values often starts with “#”, so there is the following numberformatexception.


At this time, you need to check whether the name of the wrong resource starts with a number. If it starts with a number, rename it. If not, try to check whether the name of the resource starts with a space in eclipse (of course, the error at this time is that the drawable file cannot be found). If so, modify it. If not, delete the image and add it again.

After renaming, if the layout file cannot be displayed normally, refresh the preview of the layout view or restart the development tool.

Read More: