android pp\src\main es\mipmap-xxxhdpi\ic_launcher.png:AAPT:错误:无法读取 PNG 签名:文件不以 PNG 签名开头

问题描述 投票:0回答:1

正在使用包 flutter_launcher_icons 为我的 flutter 应用程序生成启动器图标,

使用文档中提到的方法,我添加了该文件并在我的

pubspec.yaml

上提到了它
flutter_icons:
  android: launcher_icon
  image_path: assets/images/launcher_icon.png
  ios: true
  remove_alpha_ios: true

然后使用

调用它
flutter pub get
flutter pub run flutter_launcher_icons

所有文件的生成都没有问题,但是当我运行时

flutter build appbundle --release

收到此错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > Android resource compilation failed
        ERROR:D:\Flutter\dawri_flutter\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

        ERROR:D:\Flutter\dawri_flutter\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: AAPT: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
      > Android resource compilation failed
        ERROR:D:\Flutter\dawri_flutter\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

        ERROR:D:\Flutter\dawri_flutter\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: AAPT: error: file failed to compile.

android flutter dart flutter-launcher-icons
1个回答
0
投票

这是我第二次收到此错误。我只是生成新的启动器图标并将其替换为导致错误的旧图标。使用 https://www.appicon.co/.

生成启动器图标
© www.soinside.com 2019 - 2024. All rights reserved.