当我尝试将我的应用程序连接到 Firebase 身份验证时出现 MissingPluginException 异常
Posted
技术标签:
【中文标题】当我尝试将我的应用程序连接到 Firebase 身份验证时出现 MissingPluginException 异常【英文标题】:MissingPluginException exception when I try to connect my app to firebase authentication 【发布时间】:2021-02-08 11:22:05 【问题描述】:当我尝试使用我的颤振项目初始化 firebase 时,我收到此错误:
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] 未处理的异常:MissingPluginException(在通道 plugins.flutter.io/firebase_core 上找不到方法 Firebase#initializeCore 的实现)
起初我以为它与 firebase 核心页面有关,但我尝试使用旧页面,但仍然遇到同样的错误
完整的错误:
E/flutter ( 8415): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
E/flutter ( 8415): #0 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:157
E/flutter ( 8415): <asynchronous suspension>
E/flutter ( 8415): #1 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:332
E/flutter ( 8415): #2 MethodChannel.invokeListMethod
package:flutter/…/services/platform_channel.dart:345
E/flutter ( 8415): #3 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:30:36)
E/flutter ( 8415): #4 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:75:13)
E/flutter ( 8415): #5 Firebase.initializeApp (package:firebase_core/src/firebase.dart:43:25)
E/flutter ( 8415): #6 main
package:crypto_wallet/main.dart:7
E/flutter ( 8415): #7 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:231:25)
E/flutter ( 8415): #8 _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 8415): #9 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 8415): #10 _runZoned (dart:async/zone.dart:1630:10)
E/flutter ( 8415): #11 runZonedGuarded (dart:async/zone.dart:1618:12)
E/flutter ( 8415): #12 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:223:5)
E/flutter ( 8415): #13 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
E/flutter ( 8415): #14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter ( 8415):
依赖关系:
dependencies:
flutter:
sdk: flutter
firebase_core: "^0.5.0+1"
firebase_auth: "^0.18.1+2"
cloud_firestore: "^0.14.1+3"
这是我的主要功能:
void main () async
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
build.gradle 文件(依赖项)
dependencies
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
【问题讨论】:
你声明主异步了吗? 你能用你的 build.gradle 文件编辑你的问题吗? @Peter Haddad 是的,我做到了 @Akif 是的,现在看看吧 【参考方案1】:我假设您和here 有同样的问题。因此,您需要使用以下内容更改 build.gradle 文件中的相关部分:
'com.android.tools.build:gradle:3.5.0'
您可以从here阅读更多内容。
【讨论】:
以上是关于当我尝试将我的应用程序连接到 Firebase 身份验证时出现 MissingPluginException 异常的主要内容,如果未能解决你的问题,请参考以下文章
我正在尝试将我的本地 spring boot 应用程序连接到我的 heroku postgres db
从 Flutter 应用通过本地网络连接到 Firebase 函数模拟器
将 Android Studio 项目连接到 Firebase 数据库的问题