2012-02-27 59 views
1
故障处理PNG图像

我在res/drawable文件夹中保存我的图像,但它仍然是给我的控制台错误:在Android的

[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'). 

我已保存的图像(PNG格式)的资源此错误,但它给我一个错误,说明它不是PNG文件。谁能帮我吗?

+1

将图像上传到某处。我认为该图像不是一个PNG文件或损坏。 – rekire 2012-02-27 13:41:16

+0

我已经将文件保存在PNG格式 – Rahul 2012-02-27 13:44:42

+0

它是res/drawable不是资源/可绘制的(请参阅您的问题的第1行)。 – Stefan 2012-02-27 13:45:59

回答

6

一个简单但耗时的解决方案... 尝试在mspaint中打开您的PNG,并保存为。这个问题将解决.. 我不知道为什么我们需要做..但不知何故,它的工作对我来说...

2

检查this链接,参考

的Android不支持24位和32位, 但它有一些问题与ADOBE PHOTOSHOP的PNG文件。 所以解决方案是在MS Paint中打开并再次保存,如Kalpesh Patel所说。

希望这可以帮助你

1

这是因为任何JPG文件中被错误地转换为png文件。如果您在可绘制文件夹(资源文件夹)中添加了任何图像,请确保所有图像扩展名应为png,表示不要将扩展名jpg更改为png。如果你想将JPG转换为PNG,那么使用在线工具或编辑器进行转换。

问题是如果图像没有正确转换为PNG,那么当你运行的时候会出现这个错误。

解决方案:第1步是否最近在可绘制文件夹中添加了任何图像?如果是的话,检查所有的图像扩展应该是适当的(我的意思是不强制添加PNG扩展)。

第二,如果你不知道哪个图像扩展是不妥当的,那么你应该有编辑在编辑器或在线工具的所有PNG图像并再次保存成PNG文件,这个问题将得到解决的当然。

我花了3个小时对此进行了解,我想出了这个解决方案。这是我的错误,我编辑JPG图像PNG,但它没有正确转换为PNG,所以这就是为什么它给了我错误。当我选择该图像并正确转换为PNG文件后,它对我有用!