Flutter Firebase Setup for Android and IOS

0

This guide walks you through Flutter Firebase Setup for Android and IOS in 2025, using manual method. Without using the FlutterFire CLI.

What you’ll get by the end

  • Firebase project created and connected
  • google-services.json (Android) and GoogleService-Info.plist (iOS) correctly placed
  • Gradle and CocoaPods configured
  • A verified run using firebase_core

Then, we have to follow the step-by-step process to connect Firebase to the Flutter app. Once your Flutter project is ready, we will start setting up Firebase.

Create a Firebase project.

  • Go to the Firebase Console.
  • Click Add project → give it a name.
  • (Optional) Enable Analytics.
  • Once created, open the new project.

Firebase Setup for Android

  1. In Firebase Console, open Project settings → Your apps → Add app → Android.
  2. Enter:
    • Android package name → must match applicationId in android/app/build.gradle (e.g., com.example.firebase_setup_demo).
    • (Optional) App nickname & SHA-1 key (required for Phone Auth, Google Sign-In).
  3. Download the google-services.json file.
  4. Place it into:
android/app/google-services.json

 

Update Gradle files

Project-level android/build.gradle.kts:

// add this plugin on the top of your build.gradle.kts files
plugins{ 
id ("com. google gms google-services") version "4,4.2" apply
}

App-level android/app/build.gradle.kts 

plugins {
id 'com.android.application'
id 'com.google.gms.google-services' // <- add this
}


android {
defaultConfig {
minSdkVersion 23
}
}

Add the latest ndkVersion

ndkVersion = "27.0.12077973"

 

Firebase setup for IOS

  1. In Firebase Console, Add app → iOS.
  2. Enter:
    • iOS bundle ID → must match the PRODUCT_BUNDLE_IDENTIFIER in Xcode (Runner target → Signing & Capabilities → Bundle Identifier).
    • (Optional) App nickname & App Store ID.
  3. Download the GoogleService-Info.plist file.
  4. On the other hand, Open the ios folder in Xcode and drag GoogleService-Info.plist into the Runner project (make sure “Copy items if needed” is checked and it’s added to the correct target).
  5. Imoort firebase core and add configuration on AppDelegate.swift.
import Flutter
import UIKit
import FirebaseCore // add this 

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure() 
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Update Podfile

In ios/Podfile:

platform :ios, '15.0' (atlist 13 is required)

Install pods if not already installed:

cd ios
pod install
cd ..

Finally, both and android and ios setup is completed.

Add Firebase packages

In your project root, run

flutter pub add firebase_core
# Add more as needed (only for required case)
flutter pub add firebase_auth cloud_firestore

Run:

flutter pub get

Initialize Firebase in Dart

Edit lib/main.dart:

import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';


Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(); // Manual setup uses platform config files
runApp(const MyApp());
}

Overall, Everyting is completed for Flutter Firebase Setup for Android and IOS. Run the app on both the device.

Common issues

  • Android: No matching client found → Ensure google-services.json is inside android/app/.
  • iOS: Plist not found → Ensure GoogleService-Info.plist is inside Runner target in Xcode.
  • minSdkVersion issue → Set minSdkVersion 23 in android/app/build.gradle.
  • Pod errors → Run pod repo update && pod install inside ios/.

Also learn stripe payemnt integration in flutter.

Previous articleStore API Key in Firebase Function

LEAVE A REPLY

Please enter your comment!
Please enter your name here