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

查看:54
本文介绍了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"的执行失败.

部分文件处理失败,详情请查看日志

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- 在发布此问题之前,我已更改了所需 PNG 格式 中 diff-2 文件夹中存在的所有图像,正如我在其他帖子中看到的解决方案.

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.

注意-它现在在 Eclipse 上运行良好,我将它导入到 Android Studio 中.

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天全站免登陆