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

Flutter项目Xcode报错:缺失package product 'FirebaseCrashlytics' 求解决

解决Flutter项目Xcode报错“Missing package product 'FirebaseCrashlytics'”

以下是针对性的排查和解决步骤:

  • 核对Flutter依赖配置
    打开项目根目录的pubspec.yaml,确认已添加firebase_core和firebase_crashlytics依赖,版本号可根据最新稳定版调整,执行flutter pub get拉取依赖:

    dependencies:
      flutter:
        sdk: flutter
      firebase_core: ^2.15.0
      firebase_crashlytics: ^3.3.0
    
  • 检查iOS Podfile配置
    进入ios目录打开Podfile,确保配置符合要求:

    platform :ios, '12.0'
    use_frameworks!
    use_modular_headers!
    
    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    
    target 'Runner' do
      pod 'Firebase/Crashlytics'
      pod 'Firebase/Analytics'
    end
    
  • 彻底清理并重新安装依赖

    1. 关闭Xcode
    2. 删除ios目录下的Pods文件夹、Podfile.lock和Runner.xcworkspace
    3. 终端执行:
      pod deintegrate
      pod install
      
    4. 打开Runner.xcworkspace,按下Command + Shift + K清理构建缓存,再重新构建项目
  • 验证Xcode Build Phases配置

    1. 在Xcode中选中Runner项目,进入Build Phases
    2. 确认存在Run Script阶段,脚本内容为:
      "${PODS_ROOT}/FirebaseCrashlytics/run"
      
    3. 确保该Run Script阶段位于Compile Sources之后、Link Binary With Libraries之前,你的Input Files配置无需修改
  • 移除Xcode自动添加的Firebase包依赖
    进入Xcode的File > Add Packages...,如果列表中有Firebase相关的包,直接移除,保证所有Firebase依赖都通过CocoaPods管理,避免冲突

  • 确认GoogleService-Info.plist的有效性
    检查GoogleService-Info.plist是否已添加到Xcode的Runner目标中:进入Build Phases > Copy Bundle Resources,确认该文件在列表内,且路径正确

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 17:14:59