Android missingpluginexception(在channel plugins.flatter.io/firebase#U core上找不到方法firebase#initializecore的实现)

Android missingpluginexception(在channel plugins.flatter.io/firebase#U core上找不到方法firebase#initializecore的实现),android,firebase,flutter,flutter-desktop,Android,Firebase,Flutter,Flutter Desktop,错误描述 我正在windows桌面上运行我的颤振应用程序 我在android studio中使用主频道,以便在桌面上运行它。 我已经将firebase集成到我的应用程序中,登录注册工作正常,但当我尝试添加或从我的云firestore获取数据时,错误似乎是“没有创建firebase应用程序”[DEFAULT]-在Flatter和firebase中调用firebase.initializeApp(),这通过添加 void main() async { WidgetsFlutterBinding

错误描述 我正在windows桌面上运行我的颤振应用程序 我在android studio中使用主频道,以便在桌面上运行它。 我已经将firebase集成到我的应用程序中,登录注册工作正常,但当我尝试添加或从我的云firestore获取数据时,错误似乎是“没有创建firebase应用程序”[DEFAULT]-在Flatter和firebase中调用firebase.initializeApp(),这通过添加

void main()
async
{
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp();
   // if (USE_FIRESTORE_EMULATOR) {
   //   FirebaseFirestore.instance.settings = Settings(
   //       host: 'localhost:8080', sslEnabled: false, persistenceEnabled: false);
   // }
  runApp(MyApp());
}
到我的应用程序。 但是在添加了这个之后,我得到了一个错误:

Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Debug service listening on ws://127.0.0.1:14281/b7FohxM2yN4=/ws
Syncing files to device Windows...
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
<asynchronous suspension>
#1      MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:344:35)
<asynchronous suspension>
#2      MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:30:22)
<asynchronous suspension>
#3      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:75:7)
<asynchronous suspension>
#4      Firebase.initializeApp (package:firebase_core/src/firebase.dart:43:9)
<asynchronous suspension>
#5      main (package:res_ds/main.dart:17:4)
<asynchronous suspension>
公共规范yaml

name: res_ds
description: A new Flutter application.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  provider: ^4.3.2+2
  http: ^0.12.2
  cloud_firestore: ^0.14.2
  firebase_core: ^0.5.0
  image_picker: ^0.6.7+22


dev_dependencies:
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
     - assets/images/
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
名称:res\ds
描述:一个新的颤振应用。
#以下行可防止将包意外发布到
#pub.dev使用“pub publish”。这是私人软件包的首选。
发布到:“无”#如果要发布到pub.dev,请删除此行
#下面定义了应用程序的版本和内部版本号。
#版本号是由点分隔的三个数字,如1.2.43
#后跟可选的内部版本号,以+分隔。
#版本和制造商编号都可能在颤振中被覆盖
#通过分别指定--build name和--build number来生成。
#在Android中,版本名用作版本名,而版本号用作版本代码。
#更多关于Android版本控制的信息,请访问https://developer.android.com/studio/publish/versioning
#在iOS中,生成名称用作CbundleShortVersionString,而生成编号用作CbundLeverVersion。
#阅读有关iOS版本控制的更多信息,请访问
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
版本:1.0.0+1
环境:

sdk:“>=2.7.0Flatter Firebase插件,这就是为什么在Windows上运行时没有插件实现。

我不确定为什么人们会反对这个答案。这个问题中出现错误的原因是Windows不存在插件实现。他们在网上找到的错误消息尝试各种解决方案失败的原因是,在这种特殊情况下,错误的来源不是配置错误,而是没有实现。我已经链接到该插件的权威来源,其中列出了它支持的平台,但不包括Windows。我目前正在编写一个桌面颤振应用程序,该应用程序与Android/IOS应用程序共享许多代码,并得到相同的错误。我的应用程序使用了几个没有列出windows的软件包,但没有问题。firedart包明确声明它是“dart本机的”。所以我猜firebase不是“飞镖本地人”。如果有人解释这些“渠道”是什么意思,这将有助于我的理解。从dart到用另一种语言编写的代码的桥梁?最后,我想知道为什么谷歌说Flatter2.2支持Windows,但像Firebase这样的重要软件包还不受支持。@MichaelUhlenberg大多数软件包在所有平台上都能工作;插件是具有本机、特定于平台的代码的包。有关频道的说明,请参阅。至于支持Windows,Firebase本身不支持Windows桌面。没有Windows Firebase SDK,就像iOS和Android一样。Flatter不是Firebase,就像它不是其他插件一样,支持一个平台并不意味着所有可能的插件都会支持这个平台。
name: res_ds
description: A new Flutter application.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  provider: ^4.3.2+2
  http: ^0.12.2
  cloud_firestore: ^0.14.2
  firebase_core: ^0.5.0
  image_picker: ^0.6.7+22


dev_dependencies:
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
     - assets/images/
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages