在 Android Studio 3.2.1 中,我选择:
New flutter Application,然后输入
应用程序名称:sample_firebase_app
我选择下一步并在以下位置创建应用程序:
D:\Flutter\SampleFirebaseApplication
Firebase 公司名称的新 Flutter 应用程序:mycompanyname.com 我包括 kotlin 支持但不支持 Swift,它生成 main.dart
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
Run Code Online (Sandbox Code Playgroud)
项目编号:homeassistantmobile
在 Firebase 网站上,我创建了一个新项目:
HomeAssistantMobile
然后我选择添加
firebase 应用程序的选项我从我的 build.gradle
com.mycompanyname.samplefirebaseapp添加应用程序 ID
我注册了应用程序
然后它为我提供了下载 google-services.json 的选项
firebase 网站在以下位置显示了这一点:
My-Application/app 但我没有那个文件结构,所以我把它放在 D:\Flutter\SampleFirebaseApplication\sample_firebase_app\android\app
firebase 站点然后建议将以下内容添加到项目级 build.gradle (/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.0.1' …Run Code Online (Sandbox Code Playgroud)