简体   繁体   中英

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

i got this Error i didn't know how i would to solve it any solution Please.

when i initialise firebase im main function it show me this white screnn and flutter icon:

在此处输入图像描述

在此处输入图像描述

but when i delete this initliation this firebase app run successfully as it is:

在此处输入图像描述

and show me those errors

在此处输入图像描述

I just forget to add Google services plugin in android/app/build.gradle :

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

Make sure you have firebase_core in your pubspec.yaml Then, just use the following in your main:

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

run

flutter clean

and

flutter pub get

in your terminal.

If it still fails, please go step by step following the firebase documentation. It should work. https://firebase.google.com/docs/flutter/setup?platform=android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM