跪拜 Guibai
← All articles
Frontend · Android · Flutter

A Missing Maven Dependency in Firebase Auth Just Broke Kotlin Builds Worldwide

By 恋猫de小郭 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Any Android or Flutter team upgrading to Kotlin 2.4 and using Firebase Auth with SAM conversions will hit a hard build failure unless they pin explicit types or ensure `checker-qual` arrives transitively. The fix is trivial once diagnosed, but the root cause — a missing POM dependency in Google's own SDK — went unnoticed for years, which erodes trust in upstream release hygiene.

Summary

Firebase's `firebase-auth` AAR has shipped for years with class files that reference a Checker Framework annotation (`@UnknownInitialization`) while its POM never declared the `checker-qual` dependency. The gap was harmless until two triggers landed at once: FlutterFire rewrote `firebase_auth` from Java to Kotlin, introducing SAM lambdas that rely on type inference, and Kotlin 2.4 upgraded the missing-annotation scenario from a warning to a hard compilation error.

The result is a `Type annotation class … is inaccessible` error that hits any Kotlin project using `FirebaseAuth.IdTokenListener` or `AuthStateListener` with inferred parameter types under Kotlin 2.4, unless another dependency happens to pull in `checker-qual` transitively. FlutterFire's fix sidesteps the upstream gap entirely by adding explicit parameter types (`auth: FirebaseAuth`) so the compiler never needs to read the broken annotation path.

The episode exposes a brittle supply chain: a metadata defect in a Google SDK sat dormant for years, surfaced only when a downstream rewrite and a compiler upgrade combined. Former Flutter founder Eric also called out Firebase's architecture publicly, noting the irony of Google pushing R8 optimization on developers while its own SDK ships with unresolved compile dependencies.

Takeaways
`firebase-auth` AAR class files reference `@UnknownInitialization` from the Checker Framework, but the published POM never declared `checker-qual`.
Kotlin 2.3 emitted a warning for inaccessible type annotations; Kotlin 2.4 promotes it to a compilation error.
FlutterFire's `firebase_auth 6.6.0` Kotlin rewrite introduced SAM lambdas (`IdTokenListener`, `AuthStateListener`) that trigger Kotlin's type inference, exposing the missing annotation.
The build breaks on any Kotlin 2.4 project that uses those listeners with inferred parameter types and lacks a transitive `checker-qual` dependency.
FlutterFire's fix adds explicit parameter types (`auth: FirebaseAuth`) instead of pulling in `checker-qual`, bypassing the inference path entirely.
The same failure affects native Android Kotlin projects under identical conditions — it is not Flutter-specific.
FlutterFire's PR also upgraded CI to Kotlin 2.4.10, AGP 8.11.1, and Gradle 8.14 to catch the warning-to-error shift in testing.
Conclusions

A metadata defect in a widely used Google SDK remained dormant for years because no trigger exercised it — a reminder that supply-chain gaps often survive until a toolchain upgrade turns them into hard failures.

The fix chosen (explicit types) is cheaper and more robust than correcting the upstream POM, but it means every downstream consumer must independently discover and apply the same workaround unless Firebase fixes the AAR.

Kotlin's stricter type-annotation handling in 2.4 is a net improvement for correctness, yet it surfaces latent bugs that were previously invisible, shifting breakage risk onto library publishers who never felt pressure to fix their metadata.

The episode undercuts Google's messaging around build optimization: a first-party SDK shipped with an undeclared compile dependency, while the same organization urges developers to adopt R8 and shrink their own dependency graphs.

Concepts & terms
SAM conversion
Kotlin's shorthand for implementing a Java Single Abstract Method interface with a lambda. The compiler infers the lambda parameter type from the interface's method signature.
Checker Framework / @UnknownInitialization
A Java annotation framework for pluggable type-checking. `@UnknownInitialization` marks a reference whose initialization status is not yet determined. Firebase Auth's class file carries this annotation, but the annotation's own jar (`checker-qual`) was missing from the published POM.
POM (Project Object Model)
Maven's XML file declaring a library's dependencies, metadata, and build coordinates. A class file can reference an annotation without the POM listing the jar that provides it, creating a runtime gap for tools that need to load the annotation class.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗