flutterfirebasefirebase-cloud-messaging

Firebase messaging onMessage stopped working after upgrading gradle


I had a fully working Firebase messaging implementation. After upgrading:

compileSdk from 34 to 35

targetSdk from 34 to 35

com.google.firebase:firebase-bom from 33.1.2 to 33.9.0

com.google.firebase:firebase-messaging from 24.0.0 to 24.1.0

com.android.tools:desugar_jdk_libs from 2.0.4 to 2.1.4

gradle distribution from 8.0 to 8.12

and

com.android.application from 7.3.1 to 8.1.4

onMessage function stopped running. Not even a log runs, so it is not getting processed any more. I do get subscribed to topics, but every time a message arrives, I get on the console broadcast received for message and that is all

Please keep in mind this was fully functioning before these upgrades.

I wonder if changing target sdk requires new permissions.

Any help is appreciated.

Thank you


Solution

  • I was able to solve this by adding a name property for Firebase initializeApp like stated in this answer.

     await Firebase.initializeApp(
     name: "dev project",
     options: DefaultFirebaseOptions.currentPlatform);
    

    in case it is useful for someone in the future.