[firebase_messaging]: Android getToken() errors lose their cause since firebase-messaging 25.1.0 ("FCM Registration failed!")

Abierto
#18,997 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@SelaseKay ya está trabajando en esto.

Desde el 24/11/2026.

  • #18999 de @SelaseKay — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
android, dart, java
Área
mobile

Línea de trabajo

Start with the Android side of FirebaseMessaging.getToken() and the Dart error mapping that turns the native exception into firebase_messaging/unknown. Reproduce with the adb steps in the issue, then check how the underlying exception cause is dropped. Pull request #18999 is already open against this, so review it before starting. Done means the native failure reason, such as SERVICE_NOT_AVAILABLE, reaches Dart.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Needs Attention platform: android plugin: messaging reproduced type: bug
Is there an existing issue for this?
  • I have searched the existing issues.
Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

Since firebase_core 4.11.0 (Firebase Android BoM 34.15.0, firebase-messaging 25.1.0), when the token registration fails, getToken() on Android reaches Dart with the same text, whatever the reason:

[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

The underlying reason, such as SERVICE_NOT_AVAILABLE or AUTHENTICATION_FAILED, does not reach Dart. Apps can no longer tell a network problem apart from other registration failures.

We see this on many Android devices and versions in production and can't tell the failures apart.

Reproducing the issue

Setup

  • Pixel 5, Android 14, Google Play services
  • firebase_messaging 16.7.0, firebase_core 4.15.0 (Firebase Android BoM 34.19.0, firebase-messaging 25.1.3)

Steps

  1. With the device online, call await FirebaseMessaging.instance.deleteToken(). This removes the cached token, so the next getToken() has to register again.
  2. Block network access for Google Play services:
    adb shell cmd connectivity set-chain3-enabled true
    adb shell cmd connectivity set-package-networking-enabled false com.google.android.gms
    
  3. Call await FirebaseMessaging.instance.getToken().

Result

After about 30 seconds, getToken() throws:

[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

The app's logcat has no FirebaseMessaging line about it.

Clean up

adb shell cmd connectivity set-package-networking-enabled true com.google.android.gms
adb shell cmd connectivity set-chain3-enabled false

Then call getToken() again to register a new token.

Firebase Core version

4.15.0

Flutter Version

3.44.9

Relevant Log Output
# getToken() after deleteToken(), Play services blocked
[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

# FCM's own token sync at app start, same failure
E/FirebaseMessaging: Topic sync or token retrieval failed on hard failure exceptions: FCM Registration failed!. Won't retry the operation.
[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!
Flutter dependencies
Expand Flutter dependencies snippet

firebase_core 4.15.0
firebase_messaging 16.7.0
firebase_messaging_platform_interface 4.10.0

Additional context and comments

No response

Lenguaje dominante
Dart
Estrellas
9.3k
Forks
4.1k
Merge medio
4 d 17 h
PR fusionados (30 d)
49

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/flutterfire

Todos los issues de firebase/flutterfire

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.