Trying again tp log this issue, it was accidentally marked as closed by me.
In a native Skip Fuse app, the skip-firebase Firestore Codable convenience APIs crash at runtime on Android with a force-unwrap of nil.
The lower-level primitive APIs (addSnapshotListener, QueryDocumentSnapshot.data(), DocumentReference.setData([String:Any]) with primitive values) all work fine, so this is isolated to the Codable/JNI-method-ID path.
Affected (all fail at SkipFirebaseFirestore_Bridge.swift:2787):
- DocumentSnapshot.decoded() — read path (primary, cleanest repro)
- CollectionReference.addDocument(data:) — write path
Related write-path failures (likely same root cause / adjacent):
-
addDocument(from:) on 0.19.0 fails earlier in SkipBridge/BridgedTypes.swift:198 ("Unable to bridge Swift instance … missing // SKIP
@bridge")
-
addDocument(from:) on main with a Date field fails in SkipBridge.AnyBridging.toJavaObject (the FirestoreEncoder-produced Timestamp doesn't
bridge to Kotlin)
Minimal reproduction
import SkipFirebaseFirestore
struct Trip: Codable {
var title: String
var currency: String
}
// In a snapshot listener (or a one-shot getDocuments) with >= 1 document present:
db.collection("trips").addSnapshotListener { snapshot, error in
for doc in snapshot?.documents ?? [] {
let trip: Trip = try! doc.decoded() // <-- CRASHES here on Android
}
}
Important: the crash only fires when there is at least one document to decode. An empty result set never calls decoded(), so the bug is easy to miss in early testing.
Expected
doc.decoded() returns a decoded Trip, as it does on iOS via data(as:).
Actual — runtime crash
F SwiftRuntime: SkipFirebaseFirestore/SkipFirebaseFirestore_Bridge.swift:2787:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
Key stack frames (demangled):
#00 libswiftCore: _assertionFailure(...)
#2 SkipFirebaseFirestore.Java_decoded_0_methodID … _WZ // swift_once init thunk
#3 swift::threading_impl::once_slow(...)
#4 SkipFirebaseFirestore.Java_decoded_0_methodID … Vvau // lazy global accessor
#5 SkipFirebaseFirestore.DocumentSnapshot.decoded() throws (closure)
#8 SkipFirebaseFirestore.DocumentSnapshot.decoded() throws
Environment
- skip-firebase 0.19.0 and main (HEAD 2026-06-14) — both reproduce the :2787 crash for their respective methods
- Skip 1.9.2, skip-fuse-ui 1.0.0, native Skip Fuse app (SKIP_BRIDGE, TARGET_OS_ANDROID)
- Swift Android SDK swift-6.3.2-RELEASE_android; target Swift language mode v5
- Android emulator API 36.1 (android-36.1), arm64-v8a; compileSdk/targetSdk 36
- Host: macOS 26.5 (ARM), Xcode 26.5, Java 26, Gradle 9.5.1
- google-services plugin 4.4.4; Firebase BoM pulled transitively by skip-firebase
Trying again tp log this issue, it was accidentally marked as closed by me.
In a native Skip Fuse app, the skip-firebase Firestore Codable convenience APIs crash at runtime on Android with a force-unwrap of nil.
The lower-level primitive APIs (addSnapshotListener, QueryDocumentSnapshot.data(), DocumentReference.setData([String:Any]) with primitive values) all work fine, so this is isolated to the Codable/JNI-method-ID path.
Affected (all fail at SkipFirebaseFirestore_Bridge.swift:2787):
Related write-path failures (likely same root cause / adjacent):
addDocument(from:) on 0.19.0 fails earlier in SkipBridge/BridgedTypes.swift:198 ("Unable to bridge Swift instance … missing // SKIP
@bridge")
addDocument(from:) on main with a Date field fails in SkipBridge.AnyBridging.toJavaObject (the FirestoreEncoder-produced Timestamp doesn't
bridge to Kotlin)
Minimal reproduction
import SkipFirebaseFirestore
struct Trip: Codable {
var title: String
var currency: String
}
// In a snapshot listener (or a one-shot getDocuments) with >= 1 document present:
db.collection("trips").addSnapshotListener { snapshot, error in
for doc in snapshot?.documents ?? [] {
let trip: Trip = try! doc.decoded() // <-- CRASHES here on Android
}
}
Important: the crash only fires when there is at least one document to decode. An empty result set never calls decoded(), so the bug is easy to miss in early testing.
Expected
doc.decoded() returns a decoded Trip, as it does on iOS via data(as:).
Actual — runtime crash
F SwiftRuntime: SkipFirebaseFirestore/SkipFirebaseFirestore_Bridge.swift:2787:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
Key stack frames (demangled):
#00 libswiftCore: _assertionFailure(...)
#2 SkipFirebaseFirestore.Java_decoded_0_methodID … _WZ // swift_once init thunk
#3 swift::threading_impl::once_slow(...)
#4 SkipFirebaseFirestore.Java_decoded_0_methodID … Vvau // lazy global accessor
#5 SkipFirebaseFirestore.DocumentSnapshot.decoded() throws (closure)
#8 SkipFirebaseFirestore.DocumentSnapshot.decoded() throws
Environment