MissingPluginException(在通道plugins.flutter.io/firebase_core上未找到方法FirebaseApp#appNamed的实现)

时间:2020-04-09 06:07:04

标签: firebase flutter google-cloud-firestore

我拍得干净整洁, 我拍打的包裹拿到了 我做了包升级.. 创建了新项目并处理了代码。

我做了所有可能的解决方案。.仍然收到此消息。我正在移动设备(OS 7.1.1)上运行应用程序。

当我们的团队成员之一在9.0中运行相同的代码时,它工作正常。

Main.dart

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final FirebaseApp app = await FirebaseApp.configure(
    name: 'test',
    options: FirebaseOptions(
      googleAppID: (Platform.isIOS || Platform.isMacOS)
          ? '1:228413513968:ios:2e90a5913ce57f430be235'
          : '1:228413513968:android:03004231b7854bbc0be235',
      gcmSenderID: '228413513968',
      apiKey: 'AIzaSyDx4p_xoWmwz1ANPIiUJupXYYm_taUrzfI',
      projectID: 'growup-44491',
    ),
  );
  final FirebaseStorage storage = FirebaseStorage(
      app: app, storageBucket: 'gs://growup-44491.appspot.com');
  return runApp(MyApp(storage: storage)
      );
}

错误消息

E/flutter (31696): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method FirebaseApp#appNamed on channel plugins.flutter.io/firebase_core)
E/flutter (31696): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
E/flutter (31696): <asynchronous suspension>
E/flutter (31696): #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48)
E/flutter (31696): #2      MethodChannelFirebaseCore.appNamed (package:firebase_core_platform_interface/src/method_channel_firebase_core.dart:21:23)
E/flutter (31696): #3      FirebaseApp.appNamed (package:firebase_core/src/firebase_app.dart:36:45)
E/flutter (31696): #4      FirebaseApp.configure (package:firebase_core/src/firebase_app.dart:58:55)
E/flutter (31696): #5      main (package:growup/main.dart:24:45)
E/flutter (31696): #6      _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:45:6)
E/flutter (31696): #7      main (package:growup/main.dart:22:10)
E/flutter (31696): #8      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:239:25)
E/flutter (31696): #9      _rootRun (dart:async/zone.dart:1126:13)
E/flutter (31696): #10     _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (31696): #11     _runZoned (dart:async/zone.dart:1518:10)
E/flutter (31696): #12     runZoned (dart:async/zone.dart:1502:12)
E/flutter (31696): #13     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:231:5)
E/flutter (31696): #14     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
E/flutter (31696): #15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
E/flutter (31696): 
I/System.out(31696): [OkHttp] sendRequest>>
I/System.out(31696): [OkHttp] sendRequest<<
E/GraphResponse(31696): {HttpStatus: 404, errorCode: 803, subErrorCode: -1, errorType: OAuthException, errorMessage: (#803) Cannot query users by their username (CHANGE-ME)}

pubspec.yaml

name: appName
description: app desc

version: 1.0.0+1

environment:
  sdk: ">=2.1.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: ^0.1.3
  percent_indicator: "^2.1.1"
  intro_slider: ^2.2.9
  flutter_calendar_carousel: ^1.4.11
  cloud_firestore: ^0.13.4+2
  google_sign_in: ^4.4.0
  firebase_auth_ui: ^1.0.1
  firebase_storage: ^3.1.5
  uuid: ^2.0.4
  image_picker: ^0.6.4
  qr_flutter: ^3.2.0
  intl: ^0.16.1
  majascan: ^0.3.6
  country_code_picker: ^1.3.9
  shared_preferences: ^0.5.6+3
  flutter_local_notifications: ^1.4.0

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  fonts:
    - family: CenturyGothic
      fonts:
       - asset: fonts/CenturyGothic.ttf
  uses-material-design: true
  assets:
    - images/
    - images/intro/

1 个答案:

答案 0 :(得分:0)

FirebaseApp是软件包firebase_core中的类,不在您的pubspec.yaml文件中。因此,添加以下依赖项:

dependencies:
  firebase_core: ^0.4.4+3

https://pub.dev/packages/firebase_core#-readme-tab-