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

Flutter项目中google-services.json的bundle_id无法通过flutterfire配置更新

解决Flutter中google-services.json bundle_id不更新的问题

问题核心

flutterfire configure 仅同步Firebase项目中已关联的应用配置,若新bundle id未在Firebase控制台添加对应iOS应用,或执行命令时未选中目标应用,就不会触发google-services.json的更新。

解决步骤

  1. 在Firebase控制台添加新bundle id的iOS应用

    • 进入Firebase控制台对应项目,点击「添加应用」选择iOS平台
    • 输入新的bundle id,完成应用创建流程(可下载新的GoogleService-Info.plist备用)
  2. 重新执行flutterfire configure并选中目标应用
    在项目根目录执行命令:

    flutterfire configure
    

    按提示选择Firebase项目、iOS平台,务必选中刚添加的新bundle id对应的应用,而非旧应用。

  3. 手动修正google-services.json(临时方案)
    若上述方法无效,可直接编辑文件替换bundle_id:

    "services": {
      "appinvite_service": {
        "other_platform_oauth_client": [
          {
            "client_id": "xxxxxxxxxxxx.xx.com",
            "client_type": 2,
            "ios_info": {
              "bundle_id": "你的新bundle id" // 替换为正确值
            }
          }
        ]
      }
    }
    

    注意:手动修改后,后续执行flutterfire configure可能覆盖该内容,建议优先确保Firebase控制台配置正确。

  4. 清理缓存并重建项目

    • 清理Flutter缓存:
      flutter clean
      
    • 重新获取依赖:
      flutter pub get
      
    • 重启Xcode和Flutter项目,确保配置生效

额外检查项

  • 确认info.plist的CFBundleIdentifier、GoogleService-Info.plist的BUNDLE_ID与新bundle id完全一致
  • 若旧bundle id的应用已不再使用,可在Firebase控制台删除,避免执行配置命令时选错

内容的提问来源于stack exchange,提问作者Adel N. Daniel

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 01:52:04