Solvedflutterfire [firebase_crashlytics] Either the Crashlytics plugin doesn't work, or the instruction is wrong

I followed the setup instruction from Pub: https://pub.dartlang.org/packages/firebase_crashlytics

I also enabled debug logging: https://firebase.google.com/docs/crashlytics/force-a-crash

Crashlytics seems to be running when my app is started:

04-11 19:48:09.800  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.801  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.836  5815  5863 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.836  5815  5863 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.836  5815  5863 D Fabric  : Generating Crashlytics ApiKey from google_app_id in Strings
04-11 19:48:09.847  5815  5873 D Fabric  : Using AdvertisingInfo from Preference Store
04-11 19:48:09.850  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.850  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.852  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.852  5815  5863 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:09.852  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.852  5815  5815 D Fabric  : Generating Crashlytics ApiKey from google_app_id in Strings
04-11 19:48:09.852  5815  5815 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:09.853  5815  5815 I CrashlyticsCore: Initializing Crashlytics 2.6.8.32
04-11 19:48:09.855  5815  5873 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.856  5815  5873 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.858  5815  5873 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:09.859  5815  5815 D CrashlyticsCore: Installer package name is: null
04-11 19:48:09.865  5815  5863 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:09.882  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:09.882  5815  5815 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:09.883  5815  5815 D CrashlyticsCore: Exception handling initialization successful
04-11 19:48:09.883  5815  5815 D Fabric  : Initializing io.fabric.sdk.android:fabric [Version: 1.4.8.32], with the following kits:
04-11 19:48:09.883  5815  5815 D Fabric  : com.crashlytics.sdk.android:crashlytics [Version: 2.9.9.32]
04-11 19:48:09.883  5815  5815 D Fabric  : com.crashlytics.sdk.android:beta [Version: 1.2.10.27]
04-11 19:48:09.883  5815  5815 D Fabric  : com.crashlytics.sdk.android:answers [Version: 1.4.7.32]
04-11 19:48:09.883  5815  5815 D Fabric  : com.crashlytics.sdk.android.crashlytics-core [Version: 2.6.8.32]
04-11 19:48:09.883  5815  5815 D Fabric  :
04-11 19:48:09.884  5815  5863 D Fabric  : Requesting settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/com.myapp/settings
04-11 19:48:09.884  5815  5863 D Fabric  : Settings query params were: {instance=61ebeb4d13cce55a1f3a99f42e32b65ca2b2xxxx, build_version=1, display_version=0.0.1, source=1, icon_hash=204b9a3f51a1102e42ef65e3a6c4f8cda2ebxxxx}
04-11 19:48:09.885  5815  5879 D CrashlyticsCore: Opening a new session with ID 5CAF29790373-0001-16B7-47070E28DA82
04-11 19:48:10.625  5815  5875 D Fabric  : Using AdvertisingInfo from Reflection Provider
04-11 19:48:11.309  5815  5863 D Fabric  : Settings result was: 200
04-11 19:48:11.314  5815  5863 D Fabric  : Settings request ID: affca8bcac5aee10b1b37bf2a6cb00f6
04-11 19:48:11.315  5815  5863 D Fabric  : Writing settings to cache file...
04-11 19:48:11.320  5815  5863 D Fabric  : Loaded settings: {"settings_version":2,"cache_duration":7200,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":true,"prompt_enabled":false,"push_enabled":true,"firebase_crashlytics_enabled":true},"analytics":{"url":"https:\/\/e.crashlytics.com\/spi\/v2\/events","flush_interval_secs":120,"max_file_count_per_send":1,"track_custom_events":true,"track_predefined_events":true,"track_view_controllers":false,"flush_on_background":true,"max_byte_size_per_file":40000,"max_pending_send_file_count":20,"sampling_rate":1,"forward_to_google_analytics":false,"include_purchase_events_in_forwarded_events":false},"beta":{"update_suspend_duration":1209600,"update_endpoint":""},"app":{"identifier":"com.myapp","status":"activated","url":"https:\/\/api.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/com.myapp","reports_url":"https:\/\/reports.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/com.myapp\/reports","ndk_reports_url":"https:\/\/reports.crashlytics.com\/sdk-api\/v1\/platforms\/android\/apps\/com.myapp\/minidumps","update_required":true},"session":{"log_buffer_size":64000,"max_chained_exception_depth":16,"max_complete_sessions_count":4,"max_custom_exception_events":8,"max_custom_key_value_pairs":64,"identifier_mask":255},"prompt":{"title":"Send Crash Report?","message":"Looks like we crashed! Please help us fix the problem by sending a crash report.","send_button_title":"Send","show_cancel_button":true,"cancel_button_title":"Don't Send","show_always_send_button":true,"always_send_button_title":"Always Send"},"expires_at":1554990491315}
04-11 19:48:11.322  5815  5863 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:11.323  5815  5863 D Fabric  : Server says an update is required - forcing a full App update.
04-11 19:48:11.324  5815  5863 D Fabric  : App icon resource ID is 213136xxxx
04-11 19:48:11.326  5815  5863 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:11.326  5815  5863 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:11.326  5815  5863 D Fabric  : Generating Crashlytics ApiKey from google_app_id in Strings
04-11 19:48:11.327  5815  5863 D Fabric  : Build ID is: 597ad0fd-xxxx-xxxx-xxxx-cc4204e14e50
04-11 19:48:12.193  5815  5863 D Fabric  : Sending app info to https://api.crashlytics.com/spi/v1/platforms/android/apps/com.myapp
04-11 19:48:12.194  5815  5863 D Fabric  : App icon hash is 204b9a3f51a1102e42ef65e3a6c4f8cda2ebxxxx
04-11 19:48:12.194  5815  5863 D Fabric  : App icon size is 192x192
04-11 19:48:12.968  5815  5863 D Fabric  : Update app request ID: 8310b867f89166622217f661de62xxxx
04-11 19:48:12.968  5815  5863 D Fabric  : Result was 204
04-11 19:48:12.973  5815  5879 D CrashlyticsCore: Initialization marker file created.
04-11 19:48:12.976  5815  5873 D Fabric  : Falling back to Crashlytics key lookup from Manifest
04-11 19:48:12.977  5815  5873 D Fabric  : Falling back to Crashlytics key lookup from Strings
04-11 19:48:12.977  5815  5873 D Fabric  : Generating Crashlytics ApiKey from google_app_id in Strings
04-11 19:48:12.984  5815  5869 D CrashlyticsCore: Registered Firebase Analytics event listener for breadcrumbs: true
04-11 19:48:12.986  5815  5879 D CrashlyticsCore: Finalizing previously open sessions.
04-11 19:48:12.993  5815  5879 D CrashlyticsCore: Closing open sessions.
04-11 19:48:12.994  5815  5879 D CrashlyticsCore: Closing session: 5CAF28E302B3-XXXX-YYYY-47070E28DA82
04-11 19:48:12.994  5815  5879 D CrashlyticsCore: Collecting session parts for ID 5CAF28E302B3-XXXX-YYYY-47070E28DA82
04-11 19:48:12.994  5815  5879 D CrashlyticsCore: Session 5CAF28E302B3-XXXX-YYYY-47070E28DA82 has fatal exception: false
04-11 19:48:12.995  5815  5879 D CrashlyticsCore: Session 5CAF28E302B3-XXXX-YYYY-47070E28DA82 has non-fatal exceptions: false
04-11 19:48:12.995  5815  5879 D CrashlyticsCore: No events present for session ID 5CAF28E302B3-XXXX-YYYY-47070E28DA82
04-11 19:48:12.997  5815  5879 D CrashlyticsCore: Removing session part files for ID 5CAF28E302B3-XXXX-YYYY-47070E28DA82
04-11 19:48:13.008  5815  5879 D CrashlyticsCore: Closed all previously open sessions
04-11 19:48:13.018  5815  5879 D CrashlyticsCore: Initialization marker file removed: true
04-11 19:48:13.018  5815  5973 D CrashlyticsCore: Starting report processing in 1.0 second(s)...
04-11 19:48:14.057  5815  5973 D CrashlyticsCore: Checking for crash reports...
04-11 19:48:14.059  5815  5973 D CrashlyticsCore: No reports found.

And, according to https://github.com/flutter/plugins/blob/master/packages/firebase_crashlytics/example/lib/main.dart I can verify by manually throwing error:

throw StateError('Uncaught error thrown by app.');

(I've set enableInDevMode to true as well).

The error is indeed thrown, as shown in Android Studio "Run" panel:

E/flutter ( 5815): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Bad state: Uncaught error thrown by app.
E/flutter ( 5815): #0      SettingsRoute._login (package:app/routes/SettingsRoute.dart:61:3)
E/flutter ( 5815): <asynchronous suspension>
E/flutter ( 5815): #1      SettingsRoute.build.<anonymous closure> (package:app/routes/SettingsRoute.dart:47:32)
E/flutter ( 5815): #2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:511:14)

But my dashboard ( https://console.firebase.google.com/u/0/project/MYPROJECT/crashlytics/app/android:com.myapp/issues?state=open&time=last-seven-days&type=all ) says my app is 100% error-free.

And ABD log doesn't show anything.

What did I miss?

EDIT: Flutter doctor result:

[] Flutter (Channel master, v1.4.11-pre.12, on Mac OS X 10.13.6 17G5019, locale en-XX)
     Flutter version 1.4.11-pre.12 at /java/flutter
     Framework revision 5e52f5df55 (6 days ago), 2019-04-04 22:48:45 -0400
     Engine revision 697e541a8d
     Dart version 2.2.1 (build 2.2.1-dev.3.0 None)

[] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
     Android SDK at /java/android
     Android NDK location not configured (optional; useful for native profiling support)
     Platform android-28, build-tools 28.0.3
     ANDROID_HOME = /java/android
     Java binary at: /Applications/Development/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
     Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
     All Android licenses accepted.

[] iOS toolchain - develop for iOS devices (Xcode 10.1)
     Xcode at /Applications/Xcode.app/Contents/Developer
     Xcode 10.1, Build version 10B61
     ios-deploy 2.0.0
     CocoaPods version 1.5.3

[] Android Studio (version 3.3)
     Android Studio at /Applications/Development/Android Studio.app/Contents
     Flutter plugin version 34.0.1
     Dart plugin version 182.5215
     Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[] Connected device (1 available)
     Pixel 2 XL  709KPRW0070366  android-arm64  Android 9 (API 28)
32 Answers

✔️Accepted Answer

Having the same issue even with a really simple app:

void main() {
  Crashlytics.instance.enableInDevMode = true;
  FlutterError.onError = Crashlytics.instance.recordFlutterError;
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Test',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Test'),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: ()  => Crashlytics.instance.crash(),
          child: Icon(Icons.error),
        ), 
      ),
    );
  }
}

Other Answers:

I'm wondering if this is related to a previous issue with Crashlytics plugin:
#1149

Please try a couple of things:

  1. If you are using an IDE the error may be caught before it gets to the Crashlytics plugin and thus not reported. To avoid this run the app directly using flutter run and see if the error is reported then.

  2. Errors are only reported on app restart. So please look out for the reported log statement on app restart.

  3. Are you seeing this with the Crashlytics plugin example app?

@kroikie is it my impression or all Flutter crashes are not being processed as Fatal Exceptions by Crashlytics, so they are only reported if the user restarts the application, in opposition with the native Android behavior, whereas Fatal Exceptions are communicated right away and Non-Fatal only after a restart?

after some digging on this, make sure you understand how crashlytics works. Specifically, crashlytics does not send errors to firebase when an error occurs. Specifically, it sends errors to firebase the next time you start the app. So you must force the app to entirely stop and restart before anything will showup on firebase. Hot reload doesn't count.

Related Issues:

381
flutterfire [firebase_core_web , firebase_auth_web, cloud_firestore_web ] Plugin project :firebase_auth_web not found. Please update settings.gradle.
Hi @gsusI Please add this in flutter app -> android -> settings.gradle if you disagree please write ...
60
flutterfire [FIREBASE_AUTH] 'UserAgent.h' file not found flutter firebase iOS
I changed dependencies try this Don't use ^ in version. I am working on flutter application with fir...
59
flutterfire [firebase_messaging] <Background push notification handling - no implementation found for method FcmDartService#initialized>
So in the new firebase_messaging version support for background messages was added Actually if you d...
57
flutterfire [firebase_auth] iOS verifyPhoneNumber Token mismatch
Same problem with firebase_auth: 0.15.5+3: on the simulator I get the CAPTCHA code and it works ...
37
flutterfire [firebase_auth] iOS doesn't build when upgrade to 1.15.x
I fixed this temporarily by running pod update in ios folder Describe the bug Flutter app doesn't bu...
36
flutterfire 🐛 [firebase_auth] Incompatible with latest flutter_localizations master channel.
For now you can simply add the following to your pubspec.yaml if you need to stay on dev channel and...
34
flutterfire [cloud_firestore] no visible @interface for 'FIRQuery' declares the selector ...
cd ios and run pod update Firebase/Firestore and run build command let me know ...
32
flutterfire [firebase_messaging] Application.kt: Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected
There is a workaround mentioned in: #1613 Replace: To: Also temporary downgrade firebase_messaging t...
31
flutterfire Firebase messaging onResume and onMessage broken on iOS since Flutter 1.7.4
everybody: What would be possible other implications when removing that code? Removing those lines m...
29
flutterfire [firebase_auth] Method swizzling problem with phone auth iOS
@cielo Hi Yes i did I got Token mismatch too But when i fixed AppDelegate.swift i solved this error ...
29
flutterfire [firebase_admob 0.11.0+1] XCode Build Fails: Google-Mobile-Ads-SDK-fjgkwjemgangjofelixrcilvndtg
Hey guys I think this is because AdMob recently updated their SDK to 8.0.0(because of this firebase_...
28
flutterfire [firebase_messaging] Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected
Fixed by replace with: Following the instructions on pub.dev for handling background messages doesn'...
28
flutterfire [firebase_messaging] Android v2 embedding crashes
Why is this not labelled severe? This causes crash dialogs to show periodically when the application...
26
flutterfire 🐛 [firebase_messaging][firebase_auth] Data-only messages not received in iOS. Never fires anything in onMessage
Disabling method swizzling and using the below in my AppDelegate.swift Bug report Describe the bug O...
23
flutterfire 🐛 [firebase_remote_config: 0.4.1] Plugin using removed method, causing app to crash
Fixed for me by using implementation platform('com.google.firebase:firebase-bom') instead of impleme...
22
flutterfire [firebase_messaging] The application cannot be created when I add the Aplication.java
Hi I want to use firebase notifications in my application I'm adding Aplication.java for this After ...
22
flutterfire 🐛 [Crashlytics] iOS build crashes when adding crashlytics
@kuromukira Workaround for Flutter 2.0.4 is to use firebase_crashlytics from git instead of pub.dev ...
21
flutterfire [Cloud Firestore] fatal error: module 'cloud_firestore' not found
I think I managed to workaround the issue I got this error as well after integrating cocoapods mysel...
20
flutterfire Warnings from the cloud_firestore plugin on Android: FirebaseCorePlugin.java uses unchecked or unsafe operations
set: multiDexEnabled true solved for me project/android/app/build.gradle: Steps to Reproduce Create ...
18
flutterfire firebase-messaging: Android Integration
@OliverWangWei Sorry.. It was a mistake to edit the MainActivity.kr file Android Integration I'm not...
18
flutterfire [firebase_crashlytics] Either the Crashlytics plugin doesn't work, or the instruction is wrong
Having the same issue even with a really simple app: I followed the setup instruction from Pub: http...
18
flutterfire 🐛 [firebase_core] java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzji@dbed45a
I get the same error as @kw2019ltd : I get it in a new created flutter project with the only depende...
17
flutterfire [firebase_messaging] version 6.0.7 brokes builds
I solved it. Adding the plugin dependencies in app/build.gradle My project cannot be built or runned...
16
flutterfire [all] Flutter Android build fails with firebase dependencies.
Hey @erluxman I am using Android Studio 3.5 stable java -version 1.8 and this is the issue : I have ...
16
flutterfire [cloud_firestore] INTERNAL ASSERTION FAILED: A transaction object cannot be used after its update callback has been invoked.
Tracked this down to Firebase offline use and Transactions Describe the bug App crash when adding ne...
16
flutterfire [firebase_admob] ads invades safe area and close button is blocked on iPhone X
Having the same problem Temporary solution: Hide status bar when ads are shown Hope this issue will ...
14
flutterfire [firebase_messaging] iOS notification onResume, onLaunch callback not working
@AlexandreRoba @SandyAra same issue exists or your comment solution working fine on firebase_messagi...
14
13
flutterfire [firebase_messaging] No documentation for Android v2 embedding backgroundMessage handler
Solved it with following: app/src/build.gradle add the following: implementation com.google.firebase...
13
flutterfire Unable to use onBackgroundMessage in Firebase Cloud Messaging
Finally I got something working! I ended up using a named ReceivePort I am trying to implement an ap...
13
flutterfire 🐛 [CLOUD_FIRESTORE] The service is currently unavailable.
Keeps happening...!! what is going on ? Bug report I'm try to use Firestore with Flutter Deskop (Mac...
12
flutterfire [firebase_in_app_messaging] Can't build for iOS after adding firebase_in_app_messaging
I found out how to fix this Initially Describe the bug The XCode build fails when it's processing th...
8
flutterfire 🐛 [firebase_messaging] iOS Notifications not received in 8.0.0-dev.8
I'm afraid to say that iOS is still completely dead for me on dev.9 Bug report Describe the bug Afte...
7
flutterfire 🐛 [Firebase_auth] Not persisting user on authStateChanges stream after 1.1.2
I agree with @budo385 My app was working fine with firebase_auth 1.1.0 version ...
7
flutterfire [firebase_auth] The reload() function on a FirebaseUser doesn't seem to be working.
Please fix this Hey when calling the .reload() function on a FirebaseUser nothing seems to happen ...
6
flutterfire 🐛 [firebase_crashlytics] Failed to retrieve settings from https://firebase-settings.crashlytics.com
May be it's a 24 hours patience game or try the solution below: Few changes made were: Add implement...
5
flutterfire [<Firebase_Auth>] Unhandled Platform Exception Before Able to Catch SignInWithEmailAndPassword FirebaseAuthException
I am able to replicate this issue on latest stable (1.20.3) while debugging signInWithEmailAndPasswo...
3
flutterfire [Firebase Messaging] onBackgroundMessage Never Called
this is how i have created a Notification Handler Class I followed the tutorial on how to add the li...
3
flutterfire [firebase_messaging] firebase_messaging plugin causing build error in android
@DagobertDokate comment out firebase_messaging: ^5.1.5 run flutter pub get then add firebase_messagi...
3
flutterfire Flutter heads up notification for Android
@abdallahshaban557 @vipinnegi90 For Now use flutter_local_notification to create a notification chan...
3
flutterfire 🐛 [Firebase_Auth] Auth Blocking iOS firebase_messaging dev callbacks
Have the same problem on iOS 😕 Bug report Describe the bug didReceiveRemoteNotification is used in ...
3
flutterfire 🐛 [firebase_messaging] Can't use 3rd party plugins in background handler
@asmodeoux @markusaksli-nc Allright I'm back with a workaround Bug report Describe the bug None of 3...
459
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
449
flutter App Store iOS submission fails: The bundle Runner.app/Frameworks/App.framework does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
418
flutter 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My gradle.build file is: flutter doctor: ...
409
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
383
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...