You need to enable JavaScript to run this app. 使用VSCode开发Flutter+Firebase项目GoogleService-Info.plist存放位置咨询
优惠活动
大模型
产品
解决方案
定价
更多

使用VSCode开发Flutter+Firebase项目GoogleService-Info.plist存放位置咨询

报错信息:

Exception has occurred. FirebaseException ([core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project?

该报错是iOS端Firebase配置文件缺失或配置错误导致的。GoogleService-Info.plist是iOS端专属的Firebase配置文件,正确存放和配置方法如下:

正确存放路径

直接将下载好的GoogleService-Info.plist文件放到Flutter项目的以下路径:

你的项目根目录/ios/Runner/GoogleService-Info.plist

注意:不要将文件存放在ios/Runner/Resources/等子目录、项目根目录或安卓相关目录下,否则iOS编译时无法识别该配置文件

额外必要配置(必做)

仅将文件放到对应路径依然会触发报错,还需要将文件关联到Xcode的编译配置中,操作如下:

  • 右键点击项目中的ios文件夹,选择「在Xcode中打开」
  • 在Xcode左侧项目导航栏右键点击Runner文件夹,选择「Add Files to "Runner"...」
  • 在弹出的文件选择框中找到刚才放入的GoogleService-Info.plist,勾选「Copy items if needed」,同时在「Add to targets」列表中勾选Runner
  • 点击「Add」完成配置

验证方法:配置完成后,在Xcode中打开Runner → Build Phases → Copy Bundle Resources,可以在列表中看到GoogleService-Info.plist即说明配置生效,重新运行项目即可解决报错。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.16 05:06:04