简体   繁体   中英

Why is google analytics data not being collected for my android Flutter app?

I have released the android app and the iOS app of my Flutter project. In my project, I have used firebase_messaging and firebase_remote_config libraries and both of these features are properly working in both android and iOS app. Google Analytics is enabled in the Firebase project. From the analytics dashboard, it is seen that the analytics data (eg daily active users, first_open event etc) are automatically being collected for the iOS app, but not for the android app.

I have properly followed Steps 1-3 mentionedhere in the official documentation . However, in the dashboard I am getting the following for android.

在此处输入图像描述

What point am I missing in android project setup? Is this related to SHA certificate fingerprint? Currently, I have only SHA-1 added.

How do I resolve this?

You don't need to include an SHA certificate in production. This is optional, just for testing.

Did you follow the documentation correctly? Please double check in case you missed a step.

Please make sure that you add a firebase analystics observer into page navigations. For just to test it, as per the documentation:

https://pub.dev/packages/firebase_analytics

MaterialApp(
  home: MyAppHome(),
  navigatorObservers: [
    FirebaseAnalyticsObserver(analytics: FirebaseAnalytics()),
  ],
);

Adding firebase_core (Step 4 here ) solved the problem. Since it was not required for iOS, I had skipped it, only later to find it mandatory for Android. Now analytics data is automatically being collected for both android and ios app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM