Rahul
Rahul

Reputation: 757

ERROR: Failure processing PNG image in Android

I have saved my images in res/drawable folder but still it is giving me this error on console

[2012-04-28 18:36:46 - Local] libpng error: Not a PNG file
[2012-04-28 18:36:46 - Local] ERROR: Failure processing PNG image D:\Android2_worksapce\Local\res\drawable-ldpi\ic_launcher.png
[2012-04-28 18:36:46 - Local] libpng error: Not a PNG file
[2012-04-28 18:36:46 - Local] ERROR: Failure processing PNG image D:\Android2_worksapce\Local\res\drawable-mdpi\ic_launcher.png
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\aboutus.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/about').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\autofare.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/auto').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\busroutes.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/bus').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\busroutes.xml:63: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/right').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\busroutes.xml:72: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cancel').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\firstscreenactivity.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/mumbai1').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\listviewofwesternavailabletrains.xml:8: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cell3').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\main.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/first').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\mumbaihelpline.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/helpline').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\selectambulance.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/ambu').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\selectedwesterntraindetails.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/list6').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\selecthospital.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/hospital').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\selectservicelistview.xml:7: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cell1').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\selecttrainline.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/curv').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\taxifare.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/taxi').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\westernavailabletrains.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/list5').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\westernavailabletrains.xml:18: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cell3').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\youareatcentral.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/local').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\youareatcentral.xml:70: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/right').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\youareatcentral.xml:79: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/cancel').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\youareatharbour.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/local').
[2012-04-28 18:36:46 - Local] D:\Android2_worksapce\Local\res\layout\youareatharbour.xml:69: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/right').

I have saved the images (in png format) in resources, but it is giving me an error stating that it's not png file. Can anyone help me out?

Upvotes: 1

Views: 11028

Answers (3)

Manjunath Bilwar
Manjunath Bilwar

Reputation: 2353

This is because of any jpg file is mistakenly converted to a png file. If you have added any images in drawable folder (asset folder) then make sure that all images extension should be png means do not change extension jpg to png. If you want to convert jpg to png then use online tool or editor to convert.

The issue is if image is not converted properly to PNG then when you run then it will give this error.

Solution: 1st do you added any images recently in a drawable folder? if yes then check all images extension should proper (i mean do not forcefully add png extension).

or

2nd if you not sure which image extension is not proper then you should have to edit all png images in the editor or online tool and save again into png file by this issue will get solved for sure.

I have spend 3 hours on this to figure out and i come up with this solution. It was my mistake i have edited jpg image to png but it is not properly converted to png so thats why it was giving me error. After i pick that image and properly converted to png file then it work for me!

Upvotes: 1

sonu thomas
sonu thomas

Reputation: 2161

Check this link for reference

Android does support 24-bit and 32-bit, but it has some problem with ADOBE PHOTOSHOP's PNG files. So the solution is to open in MS Paint and save again as Kalpesh Patel said.

Hope this may help you

Upvotes: 2

Kalpesh Patel
Kalpesh Patel

Reputation: 1678

One Easy but time consuming solution... Try opening your png in mspaint and do save As. this issue will resolve.. i dont know why we need to do this.. but somehow its working for me...

Upvotes: 7

Related Questions