任务“:app:mergeReleaseResources”的Flutter执行失败

ddhy6vgd  于 2022-12-19  发布在  Flutter
关注(0)|答案(2)|浏览(276)

发生多个任务操作失败:执行com.android.build.gradle.internal.tasks时出现故障。Workers$ActionFacade〉Android资源编译失败AAPT:D:\抖音项目\游戏大师\安卓\app\src\main\res\mipmap-hdpi\ic_launcher.png:错误:无法读取PNG签名:文件未以PNG签名开头。D:\Flutter Projects\阅读大师\android\app\src\main\res\mipmap-hdpi\ic_launcher.png:错误:文件无法编译。

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: error: file failed to compile.

当我尝试通过**flutter build apk --split-per-abi**命令构建项目时发生此错误。我不知道这是怎么回事?请帮助

eanckbw9

eanckbw91#

构建器会优化应用中的图像,在本例中为png图像。这是为了减小apk的大小。但在您的情况下无法实现这一点。要在不进行优化的情况下运行,您可以将以下内容放入build.gradle

android {
buildTypes {
    release {
        crunchPngs false // or true
    }
  }
}
iszxjhcz

iszxjhcz2#

我在res/drawable中将.png文件更改为.jpg,它对我很有效

相关问题