Search code examples
firebasefluttercrashlyticsgoogle-fabriccrashlytics-android

Crash-free statistics monitor not working in Firebase Crashlytics in Flutter


I tried to set-up Firebase Crashlytics in my Flutter application. Everything works and crashes are collected properly now except for one thing. Crash-free monitor is not working and I really can do nothing with that. I see this kind of message instead of data all the time:

enter image description here

1) pubspec.yaml contains following dependencies:

firebase_crashlytics: 0.1.2+4
firebase_core: 0.4.3+2
firebase_messaging: 6.0.9
firebase_analytics: 5.0.9

2) runner.dart

void run() async {
  // закрепляем ориентацию todo изменить на необходимое или убрать
  await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

  _initCrashlytics();
  _initLogger();
  _runApp();
}

void _runApp() {
  runZoned<Future<void>>(
    () async {
      runApp(App());
    },
    onError: Crashlytics.instance.recordError,
  );
}

void _initCrashlytics() {
  FlutterError.onError = Crashlytics.instance.recordFlutterError;
}

void _initLogger() {
  RemoteLogger.addStrategy(CrashlyticsRemoteLogStrategy());
  Logger.addStrategy(DebugLogStrategy());
  Logger.addStrategy(RemoteLogStrategy());
}

3) build.gradle (android)

classpath 'io.fabric.tools:gradle:1.31.2'

4) build.gradle (android/app)

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

No errors in LogCat, no warnings, nothing. I see successful initialization message in logs every time application starts:

2020-01-10 12:27:32.691 23082-23082/ru.app.biz.client.android.debug I/FirebaseInitProvider: FirebaseApp initialization successful

I even tried to add Google Analytics dependency directly into my Android module but with no luck. Both Android and iOS applications are under this issue.

What am I doing wrong?


Solution

  • Finally, I found the answer. Google Analytics was disabled in my Firebase project settings and it caused issues with crash-free widget.

    Here are steps to fix it:

    1) Go to project settings in your Firebase project console;
    2) Move to the "Integrations" tab;
    3) Click "Enable" on Google Analytics widget and go through all necessary steps;
    4) Wait a while to see the result.

    Guide