简体   繁体   English

我正在尝试构建我的 Flutter 项目的 apk,但出现错误并且无法构建

[英]I am trying to build apk of my Flutter project but an error occurs and it fails to build

Microsoft Windows [Version 10.0.18363.778] (c) 2019 Microsoft Corporation. Microsoft Windows [版本 10.0.18363.778] (c) 2019 Microsoft Corporation。 All rights reserved.版权所有。

F:\flutter_projects\i_am_rich>flutter build apk You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64. F:\flutter_projects\i_am_rich>flutter build apk 您正在构建一个包含 android-arm、android-arm64、android-x64 二进制文件的胖 APK。 If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.如果您要将应用程序部署到 Play 商店,建议使用应用程序包或拆分 APK 以减小 APK 大小。 To generate an app bundle, run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 Learn more on: https://developer.android.com/guide/app-bundle To split the APKs per ABI, run: flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split Running Gradle task 'assembleRelease'...要生成应用程序包,请运行:flutter build appbundle --target-platform android-arm,android-arm64,android-x64 了解更多信息: https://developer.android.com/guide/app-bundle拆分 APK根据 ABI,运行:flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi 了解更多信息: https://developer.android.com/studio/build/configure -apk-splits#configure-abi-split运行 Gradle 任务“assembleRelease”...

FAILURE: Build failed with an exception.失败:构建失败,出现异常。

  • What went wrong: Execution failed for task ':app:mergeReleaseResources'.出了什么问题:任务 ':app:mergeReleaseResources' 执行失败。

    Multiple task action failures occurred: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource compilation failed F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature. Multiple task action failures occurred: A failure occurred while execution com.android.build.gradle.internal.tasks.Workers$ActionFacade Android 资源编译失败 F:\flutter_projects\i_am_rich\android\app\src\main\res\mipngmap_launch-xhder : AAPT: 错误:读取 PNG 签名失败:文件不以 PNG 签名开头。

     F:\flutter_projects\i_am_rich\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.tasks.Workers$ActionFacade Android resource compilation failed F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.执行com.android.build.gradle.internal.tasks.Workers$ActionFacade Android 资源编译失败F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-mdpi\ic:anuncher.error读取 PNG 签名:文件不以 PNG 签名开头。

     F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: AAPT: error: file failed to compile.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource compilation failed F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.执行com.android.build.gradle.internal.tasks.Workers$ActionFacade Android 资源编译失败F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxxfailedApi.png:APT error读取 PNG 签名:文件不以 PNG 签名开头。

     F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: AAPT: error: file failed to compile.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource compilation failed F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.执行com.android.build.gradle.internal.tasks.Workers$ActionFacade Android资源编译失败F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxhdpi:AptAfailed.\ic:launcher读取 PNG 签名:文件不以 PNG 签名开头。

     F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: AAPT: error: file failed to compile.
  • Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. Run with --scan to get full insights.使用 --info 或 --debug 选项运行以获取更多日志 output。使用 --scan 运行以获取完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BUILD FAILED in 2m 29s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 152.6s (!) Gradle task assembleRelease failed with exit code 1在 2 米 29 秒内构建失败运行 Gradle 任务“assembleRelease”...运行 Gradle 任务“assembleRelease”...完成 152.6s(!)Gradle 任务 assembleRelease 失败,退出代码为 1

F:\flutter_projects\i_am_rich> F:\flutter_projects\i_am_rich>

I think you messed up with the icon files of your app.我认为您搞砸了应用程序的图标文件。 Try to replace the icon files.尝试替换图标文件。

If you use the https://appicon.co/ website to create the application icon, you must choose an image of png如果使用https://appicon.co/网站制作应用图标,必须选择png图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM