Home > Software engineering >  Flutter : File google-services.json is missing. The Google Services Plugin cannot function without i
Flutter : File google-services.json is missing. The Google Services Plugin cannot function without i

Time:01-29

I have already attached the google-services.json file from my firebase after connecting my flutter app and followed all the steps but I am still receiving this error. I looked for other answers on the net but none of them helped. I tried opening the app in chrome but then I recieved this error "Error: Assertion failed: D:\…\src\firebase_core_web.dart:273 options != null "FirebaseOptions cannot be null when creating the default app."

Are these connected? What can I do to solve these?

enter image description here

CodePudding user response:

For your firebase_core version is seems to be sufficient to pass the FirebaseOptions once you initialize firebase in your flutter code.

Add this.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    // Replace with actual values
    options: FirebaseOptions(
      apiKey: "XXX",
      appId: "XXX",
      messagingSenderId: "XXX",
      projectId: "XXX",
    ),
  );
  runApp(MyApp());
}

CodePudding user response:

you need to download this “google-services.json” file and paste it inside “android>app” section. Just like this- enter image description here Then click on “Next” button. Now you need to do following changes in project-level build.gradle file.

Just like this bellow code- enter image description here After updating project-level build.gradle file, Now you have add mentioned code in App-level build.gradle file enter image description here

Just like this- enter image description here enter image description here

Now, you have integrated firebase with flutter project. enter image description here

  •  Tags:  
  • Related