Flutter Firebase尚未正确初始化
我想在我的应用中使用firebase, 我写这篇文章:
main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(Myapp());
}
但是我有错误:
I/ExoPlayerImpl( 5331): Init ba5fb7d [ExoPlayerLib/2.17.0] [generic_x86, Android SDK built for x86, unknown, 30]
E/flutter ( 5331): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
E/flutter ( 5331):
E/flutter ( 5331): Usually this means you've attempted to use a Firebase service before calling `Firebase.initializeApp`.
E/flutter ( 5331):
E/flutter ( 5331): View the documentation for more information: https://firebase.flutter.dev/docs/overview#initialization
E/flutter ( 5331):
E/flutter ( 5331): #0 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:99:9)
E/flutter ( 5331): <asynchronous suspension>
E/flutter ( 5331): #1 Firebase.initializeApp (package:firebase_core/src/firebase.dart:42:31)
这是:
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
如何解决?
有人可以帮我吗?
I want to use firebase in my app,
I write this:
main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(Myapp());
}
but I got error :
I/ExoPlayerImpl( 5331): Init ba5fb7d [ExoPlayerLib/2.17.0] [generic_x86, Android SDK built for x86, unknown, 30]
E/flutter ( 5331): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
E/flutter ( 5331):
E/flutter ( 5331): Usually this means you've attempted to use a Firebase service before calling `Firebase.initializeApp`.
E/flutter ( 5331):
E/flutter ( 5331): View the documentation for more information: https://firebase.flutter.dev/docs/overview#initialization
E/flutter ( 5331):
E/flutter ( 5331): #0 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:99:9)
E/flutter ( 5331): <asynchronous suspension>
E/flutter ( 5331): #1 Firebase.initializeApp (package:firebase_core/src/firebase.dart:42:31)
and this:
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
how can I solve it?
can anyone help me, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您用以下内容替换initializeapp()行,是否可以解决问题?
Does it solve the issue if you replace the initializeApp() line with the following?