离子:任务“:mergeDebugResources"执行失败(某些文件处理失败) [英] Ionic: Execution failed for task ':mergeDebugResources' (Some file crunching failed)

查看:30
本文介绍了离子:任务“:mergeDebugResources"执行失败(某些文件处理失败)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ionic build 命令运行良好,直到我决定添加一些自定义启动画面并运行以下命令,

Ionic build command was working fine until I decided to add some custom splash screen and run the following command,

离子资源

每次运行构建命令时,我都会在运行构建命令时出现以下错误,

Post that every time I run build command, I got below error while running build command,

:mergeDebugResourcesAAPT 错误(外观为 35126910):libpng 错误:读取错误失败

:mergeDebugResourcesAAPT err(Facade for 35126910): libpng error: Read Error FAILED

FAILURE:构建失败,出现异常.

FAILURE: Build failed with an exception.

出了什么问题:

任务:mergeDebugResources"执行失败.

Execution failed for task ':mergeDebugResources'.

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

Some file crunching failed, see logs for details

试试:

构建失败

很明显,ionic resources 命令造成了一些问题.

So clearly, ionic resources command created some issues.

请帮忙!

推荐答案

在浏览了多个在线资源后,我发现 ionic resources 处理/优化了生成的 PNG 文件.发布后,当您运行 ionic build android 命令时,Android 构建本身会尝试在已处理/优化的启动画面上工作,但效果不佳并报告错误.

After going through multiple online resources, I found that ionic resources processes/optimizes the resultant PNG files. Post that, when you run ionic build android command, Android build itself tries to work on already processed/optimized Splash screens but it doesn't work well and it reports an error.

因此,修复方法是告诉 Android Build 根本不要接触这些 PNG 文件,而是继续执行它所提供的内容.怎么做?

So, the fix is to tell Android Build not to touch those PNG files at all and go ahead with what it is given. How to do that?

cruncherEnabled = false 放入platformsandroiduild.gradle 文件如下,

安卓{

aaptOptions {
cruncherEnabled = false
}

aaptOptions {
cruncherEnabled = false
}

...

重新运行构建,它通过没有任何问题!:)

Re-run the build and it goes through without any problem! :)

这篇关于离子:任务“:mergeDebugResources"执行失败(某些文件处理失败)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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