Android Studio AAPT错误:libpng错误:不是PNG文件 [英] Android Studio AAPT err: libpng error: Not a PNG file

查看:657
本文介绍了Android Studio AAPT错误:libpng错误:不是PNG文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了所有可能的解决方案,但是我仍然面临着同样的问题,而我却不清楚错误所在.

I have search all the possible available solution but still i am facing same issue with unclear error for me.

现在完整的错误是-

AAPT错误(Facade for 370671127):libpng错误:不是PNG文件 错误:任务':app:mergeDebugResources'的执行失败.

AAPT err(Facade for 370671127): libpng error: Not a PNG file Error:Execution failed for task ':app:mergeDebugResources'.

某些文件处理失败,有关详细信息,请参阅日志

Some file crunching failed, see logs for details

现在从此行 libpng错误:不是PNG文件实际上,我不知道我的任何图像文件或除此以外的其他任何文件都存在问题.

Now from this line libpng error: Not a PNG file actual i am not getting where is the problem exist either in my any image files or anything else except this.

1-在发布此问题之前,我已将diff-2文件夹中现有的所有图像更改为必需的 PNG格式,正如我在其他文章中看到的解决方案一样.

1- Before posting this issues i have changed my all the images existing in the diff-2 folders in required PNG formates as I see as solution in other post.

注意-现在我将其导入Android Studio中.在eclipse上可以正常工作.

Note- Its working fine on eclipse now I am importing this in Android Studio.

由于在项目构建期间仅显示单个(以上)错误,因此我想应该没有任何其他问题.我花了更多时间解决此问题,因此欢迎所有建议.

Since during project build only single(above) error is shown so I guess there is not should be any other issue. I have spend more time to resolve this issues so all the suggestions are welcomes for me.

推荐答案

问题出在您的png文件中.可能是您的图片已通过某些png优化工具进行了优化. Android工具使用 AAPT 工具在构建项目期间优化图像.出现此问题的原因是 AAPT 工具不知道您已经对图像进行了预处理.

The problem is in your png files. Probably you images were optimized by some png optimization tools. Android tools use AAPT tool to optimize images during building your project. The reason for this problem is that AAPT tool doesn't know that you preprocessed the image.

要在您的应用程序中解决此问题,您需要在gradle中指定选项

To get around this in your application you need to specify the option in gradle

  aaptOptions{
    cruncherEnabled = false
}

这将禁用所有png文件的 AAPT 优化.

This is disable AAPT optimization for all of your png files.

此处问了类似的问题.

这篇关于Android Studio AAPT错误:libpng错误:不是PNG文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆