问题描述
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 错误:读取错误失败
FAILURE:构建失败,出现异常.
FAILURE: Build failed with an exception.
出了什么问题:
任务:mergeDebugResources"执行失败.
Execution failed for task ':mergeDebugResources'.
部分文件处理失败,详情请查看日志
试试:
构建失败
很明显,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"执行失败(某些文件处理失败)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!