firebase-kotlin-sdk
0.10.0indexedGenerative AI integration for Firebase offering model creation, content DSL, multi-turn chat with streaming, safety filters, Vertex AI backend support, and token-estimation tools.
Generative AI integration for Firebase offering model creation, content DSL, multi-turn chat with streaming, safety filters, Vertex AI backend support, and token-estimation tools.
A Kotlin Multiplatform SDK for Firebase, with a focus on Firebase AI (Generative AI) capabilities.
Add to your gradle/libs.versions.toml:
Add to your module's build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
implementation(libs.firebase.app)
implementation(libs.firebase.ai)
implementation(libs.firebase.auth)
implementation(libs.firebase.firestore)
// Firebase Analytics: see "Firebase Analytics & Advertising ID" below
// (advertising-ID collection is opt-in via firebase-analytics-advertising).
}
}
}
See each module's README for detailed usage and examples:
firebase-analytics does not collect the advertising ID by default — no IDFA on
iOS and no AAID on Android. For most apps this is the right default: analytics keeps
working, and this Firebase Analytics configuration stays off the advertising-ID surface,
so it needs no App Tracking Transparency prompt on its own. (Other SDKs or app code that
use the IDFA / AdSupport APIs may still require App Tracking Transparency.)
commonMain.dependencies {
implementation(libs.firebase.analytics)
}
Only if you need advertising attribution (Google Ads, remarketing audiences, etc.),
additionally depend on firebase-analytics-advertising. It has no API — linking it
is enough to enable advertising-ID collection on both platforms. If you add it, update
your App Store privacy and Play Data safety declarations accordingly.
commonMain.dependencies {
implementation(libs.firebase.analytics)
implementation(libs.firebase.analytics.advertising) // opt-in: enables IDFA / AAID
}
Android note: the advertising ID is not collected by default, but the Play Services measurement libraries still merge the
com.google.android.gms.permission.AD_IDmanifest permission (matching Firebase's own default). If you want a fully clean manifest, add the following to your app manifest — but be aware it also removes for any other SDK that legitimately needs it:
Add your google-services.json to your app module and apply the Google Services plugin:
// build.gradle.kts (project)
plugins {
id("com.google.gms.google-services") version "4.4.2" apply false
}
// build.gradle.kts (app)
plugins {
id("com.google.gms.google-services")
}
Add your GoogleService-Info.plist to your Xcode project and initialize Firebase in your app delegate:
import FirebaseCore
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application( : ,
: [.: ]) -> {
.configure()
}
}
Copyright 2025 Yuki Nagai
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:
Unless applicable law agreed to writing, software
distributed under the License distributed an BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
See the License the specific language governing permissions
limitations under the License.
| Module | Description | API Coverage |
|---|
[versions]
firebase-kotlin-sdk = "0.11.1"
[libraries]
firebase-app = { module = "dev.ynagai.firebase:firebase-app", version.ref = "firebase-kotlin-sdk" }
firebase-ai = { module = "dev.ynagai.firebase:firebase-ai", version.ref = "firebase-kotlin-sdk" }
firebase-analytics = { module = "dev.ynagai.firebase:firebase-analytics", version.ref = "firebase-kotlin-sdk" }
firebase-auth = { module = "dev.ynagai.firebase:firebase-auth", version.ref = "firebase-kotlin-sdk" }
firebase-firestore = { module = "dev.ynagai.firebase:firebase-firestore", version.ref = "firebase-kotlin-sdk" }
# Opt-in: only add if you need advertising-ID (IDFA/AAID) collection.
firebase-analytics-advertising = { module = "dev.ynagai.firebase:firebase-analytics-advertising", version.ref = "firebase-kotlin-sdk" }
AD_ID<uses-permission android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
Surfaced from shared tags and platforms — no rankings paid for.