[📚] migrating-to-v27: Android fails on Expo SDK 58 (Kotlin 2.2) — document the BoM 34.19.0 override

Aperta Adatta ai principianti
#9,418 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, kotlin, react-native
Ambito
documentation

Direzione di ricerca

Inizia con la sezione Android/Kotlin di docs/migrating-to-v27.mdx e le indicazioni esistenti “Overriding Native SDK Versions”. Aggiungi una nota su Expo che spieghi l’override di BoM a 34.19.0 e l’approccio con config-plugin di Expo CNG mostrato nell’issue; valuta di aggiungere la nota corrispondente sul supporto Android a platforms.mdx. Il lavoro è concluso quando entrambi i documenti spiegano chiaramente la soluzione alternativa e quando rimuovere il pin.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Documentation Feedback

The v27 migration guide (docs/migrating-to-v27.mdx) says the only supported Android path is Kotlin ≥ 2.4.0, because Firebase Android BoM 35 / firebase-auth 25 ships Kotlin 2.4 metadata. It does not mention Expo, and Expo's current release can't meet that requirement without overriding Expo's own toolchain.

What happens on Expo

Expo SDK 58 ([email protected], [email protected]) builds with Kotlin 2.2.10 and a matching KSP pin. A fresh @react-native-firebase/{app,auth}@27.1.0 install fails at :react-native-firebase_auth:compileReleaseKotlin on EAS:

e: .../firebase-auth-25.0.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.firebase-auth-api_firebase-auth-api.kotlin_module
   Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.4.0, expected version is 2.2.0.

Nothing in the guide, the Expo install docs or platforms.mdx tells an Expo user what to do here. The only workaround offered is the unsupported -Xskip-metadata-version-check flag, which Expo CNG users can't easily apply anyway.

A smaller, already-documented workaround

v27.0.0 was cut on BoM 34.19.0 (ca054bc), and the later bump to 35 (0ca03d1) only changed gradle version strings, no Kotlin sources. So 27.x compiles fine against 34.19.0 using the override the site already documents under "Overriding Native SDK Versions":

// android/build.gradle (root)
project.ext {
  set('react-native', [versions: [firebase: [bom: '34.19.0']]])
}

For Expo CNG (no checked-in android/), the same thing as a config plugin:

// plugins/withFirebaseBom.js
const { withProjectBuildGradle } = require('expo/config-plugins')

module.exports = function withFirebaseBom(config, { bom }) {
  return withProjectBuildGradle(config, (config) => {
    config.modResults.contents += `
project.ext {
  set('react-native', [versions: [firebase: [bom: '${bom}']]])
}
`
    return config
  })
}
// app.config.js
plugins: [
  ['./plugins/withFirebaseBom.js', { bom: '34.19.0' }],
  '@react-native-firebase/app',
  '@react-native-firebase/auth',
]

Verified: the EAS build then passes and the log prints firebase.bom using custom value: 34.19.0.

Suggested change

In migrating-to-v27.mdx, under the Android/Kotlin section, add an "Expo" note along the lines of:

Expo SDK 58 builds with Kotlin 2.2 and does not yet support Kotlin 2.4. Until it does, pin the Firebase Android BoM to 34.19.0 (the last BoM built with Kotlin ≤ 2.2 that v27 was released on) using the SDK version override. For Expo CNG, apply it with a withProjectBuildGradle config plugin (example above). Remove the pin once your Expo SDK uses Kotlin ≥ 2.4.

A matching line in platforms.mdx (Android support matrix) would also help.

Environment
  • @react-native-firebase/app, auth, app-check 27.1.0
  • expo 58.0.21, react-native 0.88.1, EAS Build
  • Kotlin 2.2.10 (Expo default), KSP 2.2.10-2.0.2
Lingua principale
TypeScript
Stelle
12.3k
Fork
2.3k
Merge medio
1g 19h
PR unite (30g)
21

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di invertase/react-native-firebase

Tutte le issue di invertase/react-native-firebase

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.