Flutter: Firebase has not been correctly initialized

We Are Going To Discuss About Flutter: Firebase has not been correctly initialized. So lets Start this Flutter Article.

Flutter: Firebase has not been correctly initialized

How to solve Flutter: Firebase has not been correctly initialized

When you add google-services.json to an iOS project, you need to add it using Xcode as described in the following document:
https://firebase.flutter.dev/docs/manual-installation/ios
If you read through the page, you’ll find the following note:
adding [google-service.json] manually via the filesystem won’t link the file to the project
You need to try that then restart your app (rebuild it).
Edit: Additional Note:
You’ll also need to add firebase_core to your dependencies in pubspec.yaml.

Flutter: Firebase has not been correctly initialized

When you add google-services.json to an iOS project, you need to add it using Xcode as described in the following document:
https://firebase.flutter.dev/docs/manual-installation/ios
If you read through the page, you’ll find the following note:
adding [google-service.json] manually via the filesystem won’t link the file to the project
You need to try that then restart your app (rebuild it).
Edit: Additional Note:
You’ll also need to add firebase_core to your dependencies in pubspec.yaml.

Solution 1

When you add google-services.json to an iOS project, you need to add it using Xcode as described in the following document:

https://firebase.flutter.dev/docs/manual-installation/ios

If you read through the page, you’ll find the following note:

adding [google-service.json] manually via the filesystem won’t link the file to the project

You need to try that then restart your app (rebuild it).

Edit: Additional Note:

You’ll also need to add firebase_core to your dependencies in pubspec.yaml.

Original Author osaxma Of This Content

Solution 2

Here’s how I fixed this error:

  1. Ensure that all firebase services have been added to your pubspec.yaml file, in the dependencies section. firebase_core appears to be missing and is required to connect your flutter app to your firebase project.

You can simply add it using this command:

   flutter pub add firebase_core 
  1. Add the firebase plugins to your main file:

    import 'package:firebase_core/firebase_core.dart';
    import 'firebase_options.dart';
    
  2. Replace your void main function with an asynchronous one:

    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await Firebase.initializeApp(
        options: DefaultFirebaseOptions.currentPlatform,
      );
      runApp(const YourAppGoesHere());
    } 
    

Original Author Sharon Atim Of This Content

Solution 3

When I add the GoogleService-Info.plist file in Xcode, I used the wrong name GoogleService-Info**(1)**.plist.
If you have the same file in downloads, mac adds a number of copy to the next downloaded file.

Original Author KiriLL Sabko Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment