Native Shell
Native Shell:AI 生成的 UI,在你的应用中原生呈现,覆盖每个平台。iOS、Android、macOS、Windows 与 Linux 上的应用、GPUI 应用与网页在运行时加载已签名、沙箱隔离的 TSX 模块并绘制 th
AI 翻译
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗The complete Firebase Android SDK API in Kotlin Multiplatform common code, for every Firebase client product, on Android, iOS, macOS, tvOS, the JVM, JS and Wasm. It is built on each platform's official Firebase SDK and moved onto their newest releases every week.
com.google.firebase.*, Task and listeners included, so an Android
app's Firebase code moves into commonMain as it is.io.github.corneloaie.firebase.*), with suspending functions, Flow and
kotlinx.serialization.io.github.corneloaie:<module>.18 Firebase products: 4,117 of 4,117 Android API members available from common code (100%), measured against firebase-android-sdk 5b34dd9. Built on the Firebase Android BoM 35.1.0 (App Distribution 16.0.0-beta21), iOS SDK 13.1.1 and JS SDK 13.1.0.
| Product | Artifact | Android API | Members | Android | iOS | macOS | tvOS | JVM | JS | Wasm |
|---|---|---|---|---|---|---|---|---|---|---|
| AI Logic | firebase-ai | 884 / 884 | ✅ | ✅ | ✅ | ✅ | – | ✅ | ✅ | |
| Analytics | firebase-analytics | 153 / 153 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| App (core) | firebase-app | 46 / 46 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| App Check |
A module's coverage is the share of its Firebase Android SDK API that common code can call: the public, non-deprecated
members of its api.txt, or of the published classes for the closed-source Authentication, Analytics and Phone Number
Verification. The report behind each badge lists every member with one of these statuses:
| Status | Meaning | Counted |
|---|---|---|
OK | identical signature | yes, as available |
MAP | available with a mapped type (for example java.util.Date → Timestamp) | yes, as available |
MISS | not provided yet | yes, as missing |
OMIT | deliberately not mirrored | yes, as missing |
PLAT | the signature needs an Android-only type (Context, Activity, Uri, ...) | no |
HIDE, SKIP, UNAV | hidden in the Android SDK, deprecated, or not available yet | no |
When a platform's SDK lacks a member, it is still declared in common code. On that platform it does nothing, or
throws where it must return a value, and it carries an opt-in marker that warns at call sites compiled for that
platform: @UnsupportedOnJs (JS and Wasm) or @UnsupportedOnApple (iOS, macOS and tvOS).
Platform notes:
firebase-pnv compiles for Apple platforms,
JS and Wasm so that common code using it builds there, but its operations fail with UnsupportedOperationException
and carry @UnsupportedOnApple or @UnsupportedOnJs; only its value types, such as the token's claims, work there.NOT_IMPLEMENTED, and no in-app message is displayed. Its
Firestore lacks vector values, the BSON types and the pipeline API, which JVM code cannot use.firebase-ai-ondevice, a beta library outside the BoM whose API is deprecated in
favor of GenerativeModel.onDeviceExtension): not mirrored yet. firebase-ai covers the rest of AI Logic.// settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
// build.gradle.kts of the shared module
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.corneloaie:firebase-firestore:0.3.0")
implementation("io.github.corneloaie:firebase-auth:0.3.0")
}
}
}
Coming from GitLive's firebase-kotlin-sdk, or from version 0.1 of this one? Change the group to io.github.corneloaie
and the imports of dev.gitlive.firebase.* to io.github.corneloaie.firebase.*. The com.google.firebase.* packages
are unchanged.
To try a build of main before it is released, run ./gradlew publishToMavenLocal in this repository and add
mavenLocal() to the repositories.
The minimum SDK is 24, as Firebase BoM 35 requires. Remote Config needs core library desugaring below API 26. Phone Number Verification needs compileSdk 35 or newer, which its androidx.core dependency requires.
The modules bind to the official Firebase iOS SDK without bundling it:
each one records the firebase-ios-sdk Swift package it needs in its Maven publication, and your app inherits that
dependency. You do not add Firebase to Xcode yourself.
iosArm64, iosX64, iosSimulatorArm64, macosArm64, tvosArm64 and tvosSimulatorArm64.embedAndSignAppleFrameworkForXcode build phase). The Kotlin Gradle plugin then resolves the inherited
dependency, generates the Swift package and links it, tests included.firebase-ios-sdk: declare your own swiftPMDependencies in the shared module;
the Kotlin Gradle plugin merges them with the inherited ones.documentation/ios-firebase-linking.md explains how the dependency is passed on and which products map to which Clang modules.
Both targets bind to the official Firebase JS SDK, so they support the same modules and suit Compose Multiplatform for Web.
Firebase.initialize is the entry point on every platform. Whether you need to call it, and what it reads, depends on
the platform:
| Platform | context argument | Without options | With options |
|---|---|---|---|
| Android | required, an android.content.Context | reads the resources the Google Services Gradle plugin generates from google-services.json | uses the given options |
| iOS, macOS, tvOS | ignored | reads GoogleService-Info.plist | uses the given options |
| JS and Wasm | ignored | not supported, throws UnsupportedOperationException | uses the given options (authDomain is JS and Wasm only) |
| JVM | required, an android.app.Application from the Firebase Java SDK | not supported | uses the given options |
On Android with the Google Services plugin, the official SDK initializes the default app at startup, so no call is
needed. On Apple platforms, configure the default app once at launch, either from Swift with FirebaseApp.configure()
or from Kotlin. On JS, Wasm and the JVM, the options are always passed in code. A common function covers every case:
// commonMain
fun initializeFirebase(context: Any? = null): FirebaseApp = Firebase.apps(context).firstOrNull() ?: Firebase.initialize(
context,
FirebaseOptions(
applicationId = "1:1234567890:web:abc123",
apiKey = "AIza...",
projectId = "my-project",
databaseUrl = "https://my-project.firebaseio.com",
storageBucket = "my-project.appspot.com",
gcmSenderId = "1234567890",
authDomain = "my-project.firebaseapp.com", // JS and Wasm only
),
)
On the JVM, the Firebase Java SDK needs its platform hooks
installed before the app is created, and its Application stand-in is the context:
// jvmMain
FirebasePlatform.initializeFirebasePlatform(object : FirebasePlatform() {
val storage = mutableMapOf<String, String>()
override fun store(key: String, value: String) = storage.set(key, value)
override fun retrieve(key: String) = storage[key]
override fun clear(key: String) { storage.remove(key) }
override fun log(msg: String) = println(msg)
})
initializeFirebase(Application())
Firebase.initialize(context, options, name) creates a further named app, and Firebase.app(name) returns it. Code
written against the Android SDK can keep calling com.google.firebase.Firebase.initialize(context, options), which
follows the same rules.
The com.google.firebase packages are the Android SDK's own API, declared in common code and implemented on every
platform, so Android code compiles in commonMain without changing its imports:
import com.google.firebase.Firebase
import com.google.firebase.firestore.firestore
import kotlinx.coroutines.tasks.await
Firebase.firestore.collection("cities").document("LA")
.set(mapOf("name" to "Los Angeles", "state" to "CA"))
.addOnSuccessListener { println("Saved") }
.addOnFailureListener { e -> println("Failed: ${e.message}") }
val city = Firebase.firestore.collection("cities").document("LA").get().await()
Migrating from the Firebase Android SDK walks through moving Android code into a shared module, including the compiler-guided replacement of the few Android-only members.
The io.github.corneloaie.firebase packages wrap the same layer in suspending functions, Flow and kotlinx.serialization:
import io.github.corneloaie.firebase.Firebase
import io.github.corneloaie.firebase.firestore.firestore
@Serializable
data class City(val name: String, val state: String)
Firebase.firestore.collection("cities").document("LA").set(City("Los Angeles", "CA"))
Firebase.firestore.collection("cities").snapshots.collect { snapshot ->
val cities = snapshot.documents.map { it.data<City>() }
}
documentation/kotlin-first-api.md covers it in full: serialization settings, server timestamps, field-by-field updates, the query DSL and more.
The Data Connect Android SDK is already built on coroutines and kotlinx.serialization, so firebase-dataconnect
provides it as it is in common code, on Android, iOS, tvOS, JS and Wasm. Apple platforms go through a small Objective-C
wrapper package under firebase-dataconnect/apple, as the iOS SDK is Swift-only. On JS and Wasm,
CacheSettings.Storage.PERSISTENT behaves like MEMORY, and DataConnectSettings.host and sslEnabled are ignored.
Common code uses kotlinx.datetime.LocalDate with KotlinxDatetimeLocalDateSerializer and kotlin.uuid.Uuid with
io.github.corneloaie.firebase.dataconnect.serializers.UuidSerializer; the java.time and java.util.UUID variants are
Android-only.
The AI Logic Android SDK is also built on coroutines, Flow and kotlinx.serialization, so firebase-ai provides it as
it is in common code, on Android, iOS, macOS, tvOS, JS and Wasm: the Gemini models with streaming, chats, structured
output (generateObject with a JsonSchema) and automatic function calling, server prompt templates and the Live API.
JS and Wasm run the JS SDK's firebase/ai; Apple platforms go through a small Objective-C wrapper package under
firebase-ai/apple, as the iOS SDK is Swift-only. Requests and responses cross to those SDKs as the JSON of the REST
API, and responses are checked and errors mapped as on Android. Common code sends images as InlineDataParts (the
Android API's Bitmap overloads are Android-only). Off Android there is no on-device model (the models fall back to the
cloud, as Android does without the firebase-ai-ondevice library) and no audio conversation of the SDK's own
(LiveSession.startAudioConversation); see the module's documentation.
firebase-firestore provides the pipeline API (Firestore Pipelines, a Firestore Enterprise edition feature):
FirebaseFirestore.pipeline(), the stages of Pipeline, and com.google.firebase.firestore.pipeline (Expression,
AggregateFunction, Ordering, the stage and option classes), on Android, iOS, macOS, tvOS, JS and Wasm. On Android
the Android SDK runs; elsewhere the pipeline is built in Kotlin and execute() hands it to the platform SDK: the JS
SDK's firebase/firestore/pipelines, and on Apple the Objective-C pipeline bridge that the iOS SDK's Swift API is built
on. A few options cannot be sent everywhere, and fail execute() with UnsupportedOperationException: on Apple,
execute options and source options other than the forced index (CollectionHints.withForceIndex); on JS and Wasm, a
field reference as an option other than a nearest-neighbour search's distance field or an unnest's index field. As for
document data, Kotlin/JS sends an integral double as an integer.
Every class has an android, ios or js property holding the official SDK's object, readable in that platform's
source set, for anything common code does not reach. The JVM uses android (the Java SDK is a port of the Android
SDK) and Wasm uses js:
// androidMain
Firebase.firestore.android.firestoreSettings = FirebaseFirestoreSettings.Builder(Firebase.firestore.android.firestoreSettings)
.setPersistenceEnabled(false)
.build()
Every Monday the weekly workflow opens or refreshes the pull request "Weekly: Firebase SDK updates", which runs the full CI matrix. It moves to the newest Firebase Android BoM, iOS SDK and JS SDK, and to the Android API of the newest Firebase Android release. It regenerates the coverage reports and the table above, and lists every new Android API member that is not available yet, and any new Firebase Android product no module covers.
A Claude Code routine then implements the new members on every platform, fixes whatever the new SDKs broke, and merges the pull request once CI passes. A second routine keeps the other libraries, the build tooling and the GitHub Actions current, in one more weekly pull request. MAINTAINING.md has the details.
Issues and pull requests are welcome. To build locally:
./gradlew compileKotlinIosSimulatorArm64, or everything with
./gradlew publishToMavenLocal.Most tests need the Firebase emulators: run firebase emulators:start in the test directory (it starts Firestore in
Enterprise edition, which runs pipelines), then for example
./gradlew jvmTest, ./gradlew jsNodeTest or ./gradlew iosSimulatorArm64Test. Android instrumented tests run on a
Gradle-managed device in CI.
Before committing a change to the public API:
./gradlew updateKotlinAbi androidSourceCompatDump formatKotlin;python3 .github/scripts/weekly/coverage.py --readme README.md;MAINTAINING.md covers the API rules, the weekly automation and releasing. API documentation for each release is published here.
If firebase-multiplatform saves you time, you can support its upkeep through GitHub Sponsors or on Ko-fi.
Thank you to everyone who sponsors firebase-multiplatform. Monthly sponsors from $25 are listed here.
Be the first: become a sponsor.
firebase-multiplatform started from GitLive's firebase-kotlin-sdk, whose Kotlin-first API and Firebase Java SDK it keeps using. Thank you to GitLive and its contributors for that foundation.
firebase-appcheck |
| 28 / 28 |
| ✅ |
| ✅ |
| ✅ |
| ✅ |
| – |
| ✅ |
| ✅ |
| App Distribution | firebase-appdistribution | 62 / 62 | ✅ | ✅ | – | – | ✅ | – | – |
| Authentication | firebase-auth | 284 / 284 | ✅ | ✅ | – | ✅ | ✅ | ✅ | ✅ |
| Remote Config | firebase-config | 92 / 92 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Crashlytics | firebase-crashlytics | 36 / 36 | ✅ | ✅ | ✅ | – | ✅ | – | – |
| Realtime Database | firebase-database | 191 / 191 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Data Connect | firebase-dataconnect | 197 / 197 | ✅ | ✅ | – | ✅ | – | ✅ | ✅ |
| Cloud Firestore | firebase-firestore | 1667 / 1667 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Cloud Functions | firebase-functions | 60 / 60 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| In-App Messaging | firebase-inappmessaging | 76 / 76 | ✅ | ✅ | – | ✅ | ✅ | – | – |
| Installations | firebase-installations | 11 / 11 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Cloud Messaging | firebase-messaging | 67 / 67 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Performance Monitoring | firebase-perf | 50 / 50 | ✅ | ✅ | – | ✅ | ✅ | ✅ | ✅ |
| Phone Number Verification | firebase-pnv | 47 / 47 | ✅ | ✅ | ✅ | ✅ | – | ✅ | ✅ |
| Cloud Storage | firebase-storage | 166 / 166 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |