[英]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 文件中添加提到的代码
Now, you have integrated firebase with flutter project.现在,您已将 firebase 与 flutter 项目集成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.