简体   繁体   English

MissingPluginException(MissingPluginException(在通道 plugins.flutter.io/firebase_core 上找不到方法 Firebase#initializeCore 的实现)

[英]MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:todo_firebase/auth/authscreen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:todo_firebase/screens/home.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp();
  //initilization of Firebase app

  // other Firebase service initialization

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: StreamBuilder(
        stream: FirebaseAuth.instance.authStateChanges(),
        builder: (context, usersnapshot) {
          if (usersnapshot.hasData) {
            return Home();
          } else {
            return AuthScreen();
          }
        },
      ),
      debugShowCheckedModeBanner: false,
      theme: ThemeData(brightness: Brightness.light, primaryColor: Colors.blue),
      // ignore: dead_code
    );
  }
}

This is my main.dart code.这是我的 main.dart 代码。 I get the following output at 'await Firebase.initializeApp()': MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core))我在'await Firebase.initializeApp()'得到以下输出: MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core))

I'm trying to make a daily task app but whenever I execute it using VSCode, it builds a Windows Application that appears blank.我正在尝试制作一个日常任务应用程序,但每当我使用 VSCode 执行它时,它都会构建一个显示为空白的 Windows 应用程序。 I've written the whole code in the different sections of lib (authentication and homepage), main.dart, and pubspec.yaml but it is not executing.我已经在 lib(身份验证和主页)​​、main.dart 和 pubspec.yaml 的不同部分编写了整个代码,但它没有执行。 Kindly provide the method to fix the error, and make my app work.请提供修复错误的方法,并使我的应用程序正常工作。

Had this issue this morning.. What a problem it was!今天早上有这个问题..这是一个多么大的问题! Took me a few hours to figure out.我花了几个小时才弄清楚。 Everything is working now though!不过现在一切正常!

What did I do?我做了什么? I tried cleaning my project out, deleted ios file and ran flutter create .我尝试清理我的项目,删除 ios 文件并运行flutter create . a few times with no luck... Pulled my hair out!几次都没有运气......把我的头发拉了出来!

What fixed it?什么修好了?

  • update your gems更新你的宝石
  • delete ios file for the 5th time (LOL)第 5 次删除 ios 文件 (LOL)
  • delete "derived data" in xcode and clean build folder in xcode删除 xcode 中的“派生数据”并清理 xcode 中的构建文件夹

run flutter clean inside your project and then run flutter pub cache repair在你的项目中运行flutter clean ,然后运行flutter pub cache repair

Then you need to manually update your pubspec.yaml with the latest version of firebase core, etc. Yes make sure you delete lock file first then manually update the dependencies.然后您需要使用最新版本的 firebase 核心等手动更新您的 pubspec.yaml。是的,请确保先删除锁定文件,然后手动更新依赖项。 DO NOT run flutter pub upgrade .不要运行flutter pub upgrade Won't work.. Just manually add them in :(行不通..只需手动添加它们:(

This is what I manually added into my pubspec.yaml:这是我手动添加到我的 pubspec.yaml 中的:

cloud_firestore: ^3.2.1
firebase_core: ^1.19.1
firebase_storage: ^10.3.1
firebase_auth: ^3.4.1
firebase_messaging: ^11.4.4

First of all your app is not running on device If running then stop it and then Fire these command Flutter clean Then Flutter pub get首先你的应用程序没有在设备上运行如果运行然后停止它然后触发这些命令Flutter clean然后Flutter pub get

Then run your project然后运行你的项目

There seems to be a problem with the latest firebase_core version 1.19.0 Try to use the previous version:最新的firebase_core 1.19.0版本好像有问题尝试使用之前的版本:

firebase_core: ^1.18.0

At least this solved the problem for me.至少这为我解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MissingPluginException(在 Android 上找不到方法 Firebase#initializeCore 在通道插件上的实现。flutter.io/firebase_core) - MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) on Android 缺少插件异常(在通道插件上找不到方法 firebase#initializecore 的实现。flutter.io/firebase_core) - missingpluginexception(no implementation found for method firebase#initializecore on channel plugins.flutter.io/firebase_core) 未处理的异常 MissingPluginException:在通道 plugins.flutter.io/firebase_core 上找不到方法 Firebase#initializeCore 的实现 - Unhandled Exception MissingPluginException: No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core MissingPluginException(在通道插件上找不到方法 Firebase#initializeCore 的实现。flutter.io/firebase_core)发布模式 - MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) release mode MissingPluginException(MissingPluginException(未找到方法 camera#animate on channel plugins.flutter.io/google_maps_53)的实现) - MissingPluginException (MissingPluginException(No implementation found for method camera#animate on channel plugins.flutter.io/google_maps_53)) 未处理的异常:MissingPluginException(在通道插件上找不到方法 X 的实现。flutter.io/Y) - Unhandled Exception: MissingPluginException(No implementation found for method X on channel plugins.flutter.io/Y) MissingPluginException(未在通道插件上找到方法 init 的实现。flutter.io/google_sign_in) - MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in) MissingPluginException(在通道 plugins.flutter.io/path_provider 上找不到方法 getApplicationDocumentsDirectory 的实现) - MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider) FLUTTER 未处理的异常:MissingPluginException(在通道插件上找不到方法 map#waitForMap 的实现。flutter.io/google_maps_0) - FLUTTER Unhandled Exception: MissingPluginException(No implementation found for method map#waitForMap on channel plugins.flutter.io/google_maps_0) Flutter Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker) 错误 - Flutter Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker) Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM