Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)

问题描述 投票:0回答:3

我得到了这个错误我不知道我将如何解决它任何解决方案请。

当我初始化 firebase im 主要功能时,它会显示这个白色屏幕和颤动图标:

但是当我删除这个启动时,这个 firebase 应用程序成功运行:

并告诉我那些错误

flutter firebase google-cloud-firestore firebase-storage findbugs
3个回答
2
投票

确保你的 pubspec.yaml 中有 firebase_core 然后,只需在您的 main 中使用以下内容:

await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

奔跑

扑干净

flutter pub get

在您的终端中。

如果还是不行,请按照firebase文档一步一步来。它应该工作。 https://firebase.google.com/docs/flutter/setup?platform=android


2
投票

我只是忘记在

android/app/build.gradle
中添加Google服务插件:

apply plugin: 'com.google.gms.google-services'

0
投票

对于我的问题,我通过更改

main.dart
中的 firebase 初始化来解决它,如下所示。

await Firebase.initializeApp(options:DefaultFirebaseOptions.currentPlatform);
© www.soinside.com 2019 - 2024. All rights reserved.