Firebase.initializeApp() throwing "No Firebase App '[DEFAULT]' has been created"

Viewed 110

I keep getting this error, how can I fix this?

This is my flutter version. My Flutter version is Flutter 2.6.0-11.0.pre.

This is my flutter doctor -v, seems like there is no problem.

[√] Flutter (Channel dev, 2.6.0-11.0.pre, on Microsoft Windows [Version 10.0.19043.1348], locale ja-JP)
    • Flutter version 2.6.0-11.0.pre at C:\hobby-dev\comture-training\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4b330ddbed (8 weeks ago), 2021-09-16 17:29:58 -0700
    • Engine revision 5b81c6d615
    • Dart version 2.15.0 (build 2.15.0-116.0.dev)

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] IntelliJ IDEA Community Edition (version 2020.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.62.2)
    • VS Code at C:\Users\bowti\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.28.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 93.0.961.52

! Doctor found issues in 2 categories.

And this is my pubspec.yml.

  cupertino_icons: ^1.0.2
  google_fonts: ^2.1.0
  http: ^0.13.0
  http_parser: ^4.0.0
  firebase_core: ^1.10.0
  cloud_firestore: ^3.1.0

I AM callinig Firebase in my main function.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(WebConsoleTop());
}

Any suggestions?

I googled a lot, and found out that newest version of cloud_firestore needs "await Firebase.initializeApp();", so I did it. According to my Error log, it seems like the code "await Firebase.initializeApp();" is causing this error.

Any idea what is going on?

FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
    at Object.u [as app] (https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js:1:18836)
    at Object.app$ [as app] (http://localhost:53770/packages/firebase_core_web/src/interop/core.dart.lib.js:31:101)
    at initializeApp (http://localhost:53770/packages/firebase_core_web/firebase_core_web.dart.lib.js:101:25)
    at initializeApp.next (<anonymous>)
    at runBody (http://localhost:53770/dart_sdk.js:40064:34)
    at Object._async [as async] (http://localhost:53770/dart_sdk.js:40095:7)
    at firebase_core_web.FirebaseCoreWeb.new.initializeApp (http://localhost:53770/packages/firebase_core_web/firebase_core_web.dart.lib.js:81:20)
    at initializeApp (http://localhost:53770/packages/firebase_core/firebase_core.dart.lib.js:100:59)
    at initializeApp.next (<anonymous>)
0 Answers
Related