From: http://hualang.iteye.com/blog/1059428
When I was doing something today, I made several images with PS, but changed the suffix, So I encountered an error:
Error description:
At first, there was an error at the project in eclipse, but there was no error in searching for the folder. However, a large number of red error messages are indeed output in the control tape:
[12:44:51-imageviewtest] libpng error: Not a PNG file
[12:44:51-imageviewtest] error: Failure processing PNG Image E: \ loveandroid \ workspace \ imageviewtest \ res \ drawable \ im1_1.png
[12:44:51-imageviewtest] E: \ loveandroid \ workspace \ imageviewtest \ res \ Layout \ main. XML: 7: Error: no resource found that matches the given name (at 'src' with value
'@ Drawable/img01 ').
I didn't know what was going on at the time. I found the cause and couldn't find the error. Then I checked the file error and said whether it was a PNG file. Okay, so I changed all the images in other formats to PNG in eclipse, but the number of final modifications increased and the number of errors also increased. Then I asked some experts, I checked it on the Internet and found out that it was originally a problem of changing the file suffix. If you directly change the file Suffix in eclipse or change the suffix on the desktop, this problem arises, but if you use a drawing tool, such as PS, to change an image to a certain format, such as PNG or JPEG, and put it in drawable, there will be no errors.
To verify whether this is the case, I did a test.
In this case, the file name suffix is GIF, so refactor -- rename
Click OK to view the following error message on the console.
[12:44:51-imageviewtest] libpng error: Not a PNG file
[12:44:51-imageviewtest] error: Failure processing PNG Image E: \ loveandroid \ workspace \ imageviewtest \ res \ drawable \ im1_1.png
[12:44:51-imageviewtest] E: \ loveandroid \ workspace \ imageviewtest \ res \ Layout \ main. XML: 7: Error: no resource found that matches the given name (at 'src' with value
'@ Drawable/img01 ').
Prove that the assumption is correct.
Someone may ask if this problem occurs only when the image suffix is changed in eclipse. Answer: No
Even if you change the suffix of an image on your desktop and copy it to the drawable folder, the error still appears.
Test.jpg can be used normally. After you change the suffix to PNG on the desktop, the result is still as follows:
Note: I tried it several times. The GIF file is okay, that is, the PNG file is changed to a file in another format, or the file in another format is changed to a file in PNG format.
The solution is to use the original file name, or if this problem occurs when you change the file, it may be the cause.
Another error is the naming of files in drawable. Currently, only lowercase letters and numbers can be used to name image files.
After a moon.jpg file is added to the drawable folder, the following error occurs:
[13:11:13-imageviewtest] res \ drawable \ moon.jpg: invalid file name: must contain only [a-z0-9 _.]
[13:11:13-imageviewtest] E: \ loveandroid \ workspace \ imageviewtest \ res \ Layout \ main. XML: 7: Error: no resource found that matches the given name (at 'src' with value
'@ Drawable/img01 ').
Pay attention to these problems in the future.