简体   繁体   English

Flutter:文件 google-services.json 丢失。 没有它,Google 服务插件不能 function

[英]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.在连接我的 flutter 应用程序后,我已经从我的 firebase 中附加了 google-services.json 文件并执行了所有步骤,但我仍然收到此错误。 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." 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.一旦您在 flutter 代码中初始化 firebase ,您的 firebase_core 版本似乎足以通过 FirebaseOptions 。

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.您需要下载此“google-services.json”文件并将其粘贴到“android>app”部分。 Just like this-像这样- 在此处输入图像描述 Then click on “Next” button.然后点击“下一步”按钮。 Now you need to do following changes in project-level build.gradle file.现在您需要在项目级 build.gradle 文件中进行以下更改。

Just like this bellow code-就像下面的代码一样- 在此处输入图像描述 After updating project-level build.gradle file, Now you have add mentioned code in App-level build.gradle file更新项目级 build.gradle 文件后,现在您已在应用级 build.gradle 文件中添加提到的代码在此处输入图像描述

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

Now, you have integrated firebase with flutter project.现在,您已将 firebase 与 flutter 项目集成。 在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由以下原因引起:org.gradle.api.GradleException:文件 google-services.json 丢失。 没有它,谷歌服务插件就不能 function - Caused by: org.gradle.api.GradleException: File google-services.json is missing. The Google Services Plugin cannot function without it 无法从 Firebase 控制台下载 google-services.json 文件 - Unable to download google-services.json file from Firebase Console google-services.json api_key 从 firebase 为空 - google-services.json api_key is empty from firebase 如何将 google-services.json 文件放入 android 项目中的自定义位置 - How google-services.json file can be put to custom location within android project google-services.json Google Cloud out-login和Firebase动态链接同一个项目android - google-services.json Google Cloud outh login and Firebase dynamic link same project android google-services.json”已找到,但它表明您似乎无权访问的项目 ID - google-services.json" was found, but it indicates a project ID that you don't appear to have access to 如何在开发环境中使用没有服务 key.json 文件的谷歌服务,如 bucket 或 pub sub? - How to use the google services like bucket or pub sub without service key.json file in development environment? expo:如何根据发布通道 expo 加载不同的 google-services-json - expo: how to load different google-services-json based on release channel expo 如何使用最新的谷歌身份服务在 Angular 2+ 中实现谷歌登录 - How to Implement Google Sign in in Angular 2+, with the latest google Identity Services Google Cloud Run 404 服务之间的内部流量错误 - Google Cloud Run 404 Error on internal traffic between services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM