简体   繁体   中英

Flutter : File google-services.json is missing. The Google Services Plugin cannot function without it

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?

在此处输入图像描述

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());
}

you need to download this “google-services.json” file and paste it inside “android>app” section. Just like this- 在此处输入图像描述 Then click on “Next” button. Now you need to do following changes in project-level build.gradle file.

Just like this bellow code- 在此处输入图像描述 After updating project-level build.gradle file, Now you have add mentioned code in App-level build.gradle file在此处输入图像描述

Just like this- 在此处输入图像描述 在此处输入图像描述

Now, you have integrated firebase with flutter project. 在此处输入图像描述

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