You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter构建Google Play AppBundle失败,求助解决未知错误

问题描述

尝试构建Google Play商店的AppBundle时失败,核心错误为Dart snapshot generator failed with exit code -1073740940及AOT snapshotter exited with code -1073740940,完整错误日志如下:

Running Gradle task 'bundleRelease'...                          
Dart snapshot generator failed with exit code -1073740940
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 944 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "fa-regular-400.ttf" was tree-shaken, reducing it from 63952 to 2492 bytes (96.1% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "fa-solid-900.ttf" was tree-shaken, reducing it from 394628 to 2900 bytes (99.3% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "fa-brands-400.ttf" was tree-shaken, reducing it from 187208 to 3624 bytes (98.1% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 20612 bytes (98.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Target android_aot_release_android-arm failed: Exception: AOT snapshotter exited with code -1073740940


FAILURE: Build failed with an exception.

* Where:
Script 'D:\Dev\flutter_windows_3.10.6-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1201

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDevRelease'.
> Process 'command 'D:\Dev\flutter_windows_3.10.6-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
Running Gradle task 'bundleRelease'...                             10.3s
Gradle task bundleRelease failed with exit code 1
Process finished with exit code 1
已尝试的解决方案
  • 清理所有构建文件后重新构建
  • 搜索谷歌相关解决方案并尝试,均未生效
排查与解决建议
  1. 释放系统内存
    错误码-1073740940常与内存不足或内存访问冲突相关,构建AOT时关闭浏览器、虚拟机、其他大型软件等内存占用高的程序,释放更多内存后重试。

  2. 禁用图标摇树优化
    尝试添加--no-tree-shake-icons参数跳过图标摇树优化,构建命令:

    flutter build appbundle --release --no-tree-shake-icons
    
  3. 调整Flutter版本
    当前使用Flutter 3.10.6稳定版,可尝试升级到最新稳定版或回退至前一稳定版本(如3.7.x系列),排查版本本身的AOT编译问题:

    # 升级到最新稳定版
    flutter upgrade
    # 回退到指定版本
    flutter downgrade 3.7.12
    
  4. 排查依赖冲突
    临时移除非核心依赖包,逐步构建排查是否为某个依赖导致的AOT编译失败。

  5. 清理Flutter全局缓存
    清理项目及Flutter全局缓存后重新构建:

    flutter clean
    flutter pub get
    flutter pub cache clean
    
  6. 以管理员身份运行构建
    确保IDE或命令行工具以管理员权限启动,避免因权限不足导致的文件访问或进程启动异常。

内容的提问来源于stack exchange,提问作者BranchDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 12:16:00