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

Mac Mini M1上Flutter项目在iPhone启动过慢问题求助

Flutter项目在iOS 17.4.1实体机上卡在「Flutter Launching...」的解决方法

问题背景

在Mac Mini M1上开发Flutter项目(Flutter 3.19.4稳定版,Xcode 15.3),选择搭载iOS 17.4.1的实体iPhone执行「Run Without Debugging」后,界面一直停留在「Flutter Launching...」,应用无法加载。已尝试重启Mac、删除设备上的应用重装,问题仍存在。flutter doctor无异常,Xcode控制台日志显示Impeller启用、Firebase初始化提示未配置应用,且Dart VM已启动。

相关日志

flutter doctor输出

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.4, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.88.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Xcode控制台输出

[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
10.22.0 - [FirebaseCore][I-COR000005] No app has been configured yet.
10.22.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.10.22.0 started
10.22.0 - [FirebaseAnalytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
10.22.0 - [FirebaseAnalytics][I-ACS044002] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at ...
10.22.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
10.22.0 - [FirebaseAnalytics][I-ACS023012] Analytics collection enabled
10.22.0 - [FirebaseAnalytics][I-ACS023220] Analytics screen reporting is enabled. Call Analytics.logEvent(AnalyticsEventScreenView, parameters: [...]) to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
flutter: The Dart VM service is listening on http://0.0.0.0:60075/RUIB-EERxgs=/

解决方案

  • 临时禁用Impeller渲染:从日志看当前启用了Impeller,部分iOS 17.x版本与Impeller存在兼容性问题。可在启动时添加参数--no-enable-impeller,或在iOS项目的Info.plist中添加键FLTEnableImpeller,值设为NO。
  • 修复Firebase配置:日志提示「No app has been configured yet」,需确保GoogleService-Info.plist已正确添加到Xcode项目(添加时勾选对应target),且在main.dart中先调用FirebaseApp.configure()再执行runApp()。
  • 清理全链路缓存:
    1. 执行flutter clean,随后flutter pub get
    2. 在Xcode中按Cmd+Shift+K清理构建,再按Cmd+Option+Shift+K清理构建文件夹
    3. 进入iOS目录,执行pod deintegrate && pod install重新安装依赖
  • 验证设备信任设置:在iPhone的「设置-通用-VPN与设备管理」中,确认已信任Mac的开发者证书。
  • 切换Debug模式测试:先尝试以Debug模式启动项目,若能正常加载,再检查Release模式的配置(如权限声明、代码中Debug专属逻辑)。
  • 更新依赖或Flutter版本:尝试升级到最新Flutter稳定版,或检查pubspec.yaml中Firebase相关依赖(如firebase_core)的版本是否与当前Flutter版本兼容。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 00:37:40