You need to enable JavaScript to run this app. Flutter Windows模式运行报MissingPluginException,Firebase初始化失败如何解决?
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Windows模式运行报MissingPluginException,Firebase初始化失败如何解决?

问题排查解决方案

报错说明

Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel)
你使用的firebase_auth: ^1.3.0、cloud_firestore: ^2.2.0、firebase_database: ^6.1.2均为2021年发布的旧版本Firebase插件,该批次版本仅适配Android、iOS平台,未提供Windows平台的原生实现,因此在Windows模式运行时调用Firebase初始化方法会抛出该异常。

解决步骤

  • 若仅需调试移动端功能,直接切换到Android/iOS模拟器或真机运行,即可直接规避该报错。
  • 若必须在Windows平台运行,按以下流程操作:
    1. 升级所有Firebase相关依赖到支持Windows的最低适配版本以上:
      • firebase_core ≥ 1.10.0
      • firebase_auth ≥ 3.3.0
      • cloud_firestore ≥ 3.1.0
      • firebase_database ≥ 9.0.0
    2. 执行依赖清理与重新拉取命令:
      flutter clean
      flutter pub get
      
    3. 补充Windows平台的Firebase配置,在项目windows/runner目录下放入Firebase生成的配置文件。
    4. 确认main函数中初始化Firebase前已调用WidgetsFlutterBinding初始化:
      void main() async {
        WidgetsFlutterBinding.ensureInitialized();
        await Firebase.initializeApp();
        runApp(MyApp());
      }
      
    5. 重新编译运行项目即可。

原始报错截图

报错截图

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.13 20:48:03