Firebase analytics works on iOS but not Android

Hello,

I’m trying to add Firebase analytics to my application (v5).

Previously I have added GoogleService-Info.plist in ios\App\App and google-services.json in android\app.

My app use Angular Fire (17.0.2) for several features and is initialized using provideFirebaseApp(() => initializeApp(environment.firebaseConfig).

Firebase analytics works on iOS and this is unrelated to AngularFire, because AngularFire is for web, and in the analytics dashboard, users shows up correctly with iOS tag (even iOS version).

I’m assuming it’s because Firebase Analytics in built-in somehow.

But this doesn’t work on Android and I couldn’t make it works in a similar way, without any additional package.

My first question is: Is it possible to have firebase analytics in Android without added package / modifying heavily the Java code ?

In the meantime, I tried to use the Capacitor plugin "@capacitor-firebase/analytics": "5.4.1".

In android/app/build.gradle I have added

apply plugin: 'com.google.gms.google-services'

and also

implementation 'com.google.firebase:firebase-analytics:21.5.0'

In android/build.gradle I have added

classpath 'com.google.gms:google-services:4.3.15'

I still don’t see Android users appearing in the Realtime active users counter when I open the app on Android.

My second question is: What mistake I have made adding this plugin?

My third question is: If I’m able to successfully had this plugin, is there any conflict between the current way my iOS users are getting tracked and having in addition a package that have the same purpose ?

Thank you very much for your help.

Is there a reason you are running Capacitor 5? It is no longer supported.

You also need to target SDK 34 for Android as of August 31, 2024 which only Capacitor 6 or 7 supports.

Thank you for contributing to my questions.

No particular reason but I currently don’t have time to upgrade to 6/7.

Firebase Analytics should work the same way between 4,5,6 and 7 so I don’t think it’s the reason why I’m struggling, what do you think ?