[Flutter + Firebase] Enable Firebase for Flutter

Anroid Firebase Project setup:

1. In firebase console, cerate a Android app setup

you can find in code:

Find "applicationId", undef "defaultConfig", put to website.

 

2. Click "Regsiter App"

3. Download google-services.json

4. Copy to android/app folder

5. Click "Next" to continue

6. Open "android/build.gradle":

复制代码
buildscript {
    repositories {
        google() // Add this line
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.3.2' // Add this line
    }
}
复制代码

7. Open "android/app/build.gradle":

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
    implementation 'androidx.multidex:multidex:2.0.0'
}

apply plugin: 'com.google.gms.google-services' // Add this line

 

 

Setup Firebase for iOS:

1. Click "+ Add App", Select iOS

2. Get bundle ID:

3. Find it in: "Runner.xcodeproj", Open it with xcode

4. Click on "Runner" in xcode, to open the settings, to find "bundle identifier" and copy to input field

5. Click "Next"

6. Download GoogleService-info.plist

7. Drap the file into xcode, under "Runner" folder, it will open the dialog:

8. Back to Android studio, run the emulator, to make sure everything work correctly.

 

 

Install Flutter Firebase package:

1. Install Fireabse_core: https://pub.dev/packages/firebase_core

2. Install Firebase_aut: https://pub.dev/packages/firebase_auth

复制代码
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  animated_text_kit: ^1.3.0
  firebase_core: ^0.4.1+3
  firebase_auth: ^0.14.0+8

cloud_firestore: ^0.12.10

复制代码

3. Optional: Possible to upgrade 'Flutter SDK', 'cocoapods' and 'pod'

In Android studio, Tools, Flutter, Flutter Upgrade.

Then, in Terminal

pod repo update
sudo gem install cocoapods
pod setup

4. Restart the emluator and test your app.

 

posted @   Zhentiw  阅读(371)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2016-11-10 [AngularJS Ng-redux] Integrate ngRedux
2016-11-10 [AngularFire2] Update multi collections at the same time with FirebaseRef
2014-11-10 [Firebase] 2. Firebase Event Handling
2014-11-10 [Firebase] 1. AngularFire, $save, $add and $remove, Forge
点击右上角即可分享
微信分享提示