Flutter iOS release构建包启动闪退无错误日志问题求助
问题现象
- 当前开发的Flutter应用在debug、profile模式下均可正常构建运行,仅release模式构建的安装包无法正常使用。
- 测试环境为搭载iOS 14.8的物理iPhone设备(非模拟器),通过数据线直连部署安装包测试;因无Android测试设备,暂未确认Android端release构建是否存在同类问题。
- 目前暂无法稳定复现问题触发路径,也未定位到明确问题诱因。
已执行排查操作
- 先后执行删除Pods文件夹、Podfile、Podfile.lock,更新CocoaPods,运行
flutter clean等常规清理操作,问题未解决。 - 使用Flutter官方提供的模板新建空白项目测试,出现完全相同的异常:debug、profile模式可正常构建运行,仅release模式故障。
- 空白项目的
flutter doctor输出如下:
[✓] Flutter (Channel stable, 3.0.2, on macOS 11.4 20F71 darwin-x64, locale en-US) • Flutter version 3.0.2 at /Users/aaron/development/flutter • Upstream repository 为Flutter官方GitHub仓库 • Framework revision cd41fdd495 (发布于8天前), 2022-06-08 09:52:13 -0700 • Engine revision f15f824b57 • Dart version 2.17.3 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/aaron/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home/bin/java • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Users/aaron/Downloads/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [!] Android Studio (not installed) • Android Studio not found,可从官方渠道下载安装,参考Flutter官方macOS环境搭建文档完成Android相关配置。 [✓] Connected device (3 available) • 测试用iPhone (mobile) • 00008020-001A74AA01F9002E • ios • iOS 14.8 18H17 • iPhone 13 (mobile) • DBEAE20E-D3D1-43B5-BC15-CC8D20753EEB • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F71 darwin-x64 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 2 categories.
- 已留存
flutter run --release --verbose的完整构建日志,日志末尾可确认应用已成功部署到设备,但未记录后续异常信息。
故障表现
- release模式安装包启动时短暂显示白屏后立即闪退,终端按
q结束调试会话仅输出“Application finished”,闪退全过程无任何错误、异常日志输出,无法直接定位根因。 - 关键区分点:debug、profile模式下应用安装、运行全流程均无异常,仅release模式触发故障。
已捕获核心报错
在Xcode中抓取到release模式运行时的专属报错(profile、debug构建运行不会触发),判定为闪退核心诱因,日志内容如下:
2022-06-16 15:32:44.889467-0500 Runner[68916:5583414] Metal API Validation Enabled 2022-06-16 15:32:45.053915-0500 Runner[68916:5583414] [VERBOSE-3:dart_vm_initializer.cc(22)] Error while initializing the Dart VM: Flag dedup_instructions is false in snapshot, but dedup_instructions is always true in product mode
现寻求该问题的可行解决方案。
内容的提问来源于stack exchange,提问作者ADC2000
相关产品推荐
相关产品推荐

