Flutter: Flutter Firebase Crashlytics not showing for iOS

8,726

Solution 1

I manage to get it to work today, I had missed that you need to add the SDK for iOS in Firebase Console.

Step 1: Set up Crashlytics in the Firebase console
Click Crashlytics in the left-hand nav panel of the Firebase console.

If your Firebase project has multiple apps registered in it, select the app you just added from the dropdown next to Crashlytics in the top bar of the console.

Click Add SDK.

https://firebase.google.com/docs/crashlytics/get-started

Solution 2

$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) should only be added for Xcode 10

Also, do you have any ad blocking software setup on your network? cause that's what prevented error logging for me.

Solution 3

I Just run the app in --release mode and it showed up the first exception in the console.

flutter run --release

Note: I did everything in all the other answers and still wasn't working for me πŸ˜…

Share:
8,726
Viktor Morin
Author by

Viktor Morin

Updated on December 17, 2022

Comments

  • Viktor Morin
    Viktor Morin over 1 year

    I can't get the crash logs to show for iOS (works for Android). I have tested the following:

    1. Started the app using "flutter run", detached the debugger, trigger the crash and restarted the application (all this several time)
    2. Also tried to run from XCode and then stopped the application and trigger the crash and restarted the application
    3. Not that the crash doesn't actually make the application crash, but I don't know how to do that from flutter

    Startup:

    void main() {
      // Set `enableInDevMode` to true to see reports while in debug mode
      // This is only to be used for confirming that reports are being
      // submitted as expected. It is not intended to be used for everyday
      // development.
      Crashlytics.instance.enableInDevMode = true;
    
      // Pass all uncaught errors from the framework to Crashlytics.
      FlutterError.onError = Crashlytics.instance.recordFlutterError;
      runApp(MyApp());
    }
    

    Trigger:

    FlatButton(
      child: const Text('Crash'),
      onPressed: () {
        Crashlytics.instance.crash();
        Crashlytics.instance.log("msg");
        Crashlytics.instance.recordFlutterError(new FlutterErrorDetails());
        Crashlytics.instance.recordError(new Exception("test"), null);
      }),
    

    Settings iOS: enter image description here

    Logg:

    2020-02-07 10:47:59.988421+0100 Runner[32021:139387]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
    2020-02-07 10:48:00.467672+0100 Runner[32021:139200] Configuring the default Firebase app...
    2020-02-07 10:48:00.509841+0100 Runner[32021:139388] 6.12.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
    2020-02-07 10:48:00.564015+0100 Runner[32021:139403] 6.12.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60105000 started
    2020-02-07 10:48:00.633609+0100 Runner[32021:139403] 6.12.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
    2020-02-07 10:48:00.686296+0100 Runner[32021:139428] flutter: Observatory listening on http://127.0.0.1:51095/Jl5T2U0QjXU=/
    2020-02-07 10:48:00.703093+0100 Runner[32021:139200] [Crashlytics] Version 3.14.0 (144)
    2020-02-07 10:48:00.741256+0100 Runner[32021:139200] Configured the default Firebase app __FIRAPP_DEFAULT.
    2020-02-07 10:48:00.746360+0100 Runner[32021:139200] [Fabric] [Fabric +with] called multiple times. Only the first call is honored, please pass all kits you wish to initialize
    2020-02-07 10:48:00.788062+0100 Runner[32021:139387] 6.12.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO.
    to ensure proper integration.
    2020-02-07 10:48:00.907902+0100 Runner[32021:139387] [Fabric] failed to download settings Error Domain=FABNetworkError Code=-5 "(null)" UserInfo={status_code=403, type=2, request_id=, content_type=application/json; charset=utf-8}
    2020-02-07 10:48:03.072501+0100 Runner[32021:139403] 6.12.0 - [Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: remote notifications are not supported in the simulator
    2020-02-07 10:48:03.100106+0100 Runner[32021:139403] 6.12.0 - [Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: remote notifications are not supported in the simulator
    2020-02-07 10:49:51.975510+0100 Runner[32021:139410] flutter: Flutter error caught by Crashlytics plugin:
    2020-02-07 10:49:52.003794+0100 Runner[32021:139410] flutter: ══║ EXCEPTION CAUGHT BY GESTURE β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
    2020-02-07 10:49:52.004161+0100 Runner[32021:139410] flutter: The following StateError was thrown while handling a gesture:
    2020-02-07 10:49:52.004429+0100 Runner[32021:139410] flutter: Bad state: Error thrown by Crashlytics plugin
    2020-02-07 10:49:52.005323+0100 Runner[32021:139410] flutter:
    2020-02-07 10:49:52.006106+0100 Runner[32021:139410] flutter: When the exception was thrown, this was the stack:
    2020-02-07 10:49:52.006490+0100 Runner[32021:139410] flutter: #0      Crashlytics.crash (package:firebase_crashlytics/src/firebase_crashlytics.dart:54:5)
    2020-02-07 10:49:52.007125+0100 Runner[32021:139410] flutter: #1      _InformationPageState.build.<anonymous closure> (package:mainapp/pages/informationpage.dart:71:42)
    2020-02-07 10:49:52.007856+0100 Runner[32021:139410] flutter: #2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
    2020-02-07 10:49:52.008560+0100 Runner[32021:139410] flutter: #3      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789:36)
    2020-02-07 10:49:52.008828+0100 Runner[32021:139410] flutter: #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
    2020-02-07 10:49:52.009341+0100 Runner[32021:139410] flutter: #5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
    2020-02-07 10:49:52.009923+0100 Runner[32021:139410] flutter: #6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
    2020-02-07 10:49:52.010181+0100 Runner[32021:139410] flutter: #7      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
    2020-02-07 10:49:52.010389+0100 Runner[32021:139410] flutter: #8      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
    2020-02-07 10:49:52.011013+0100 Runner[32021:139410] flutter: #9      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
    2020-02-07 10:49:52.011399+0100 Runner[32021:139410] flutter: #10     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
    2020-02-07 10:49:52.011511+0100 Runner[32021:139410] flutter: #11     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
    2020-02-07 10:49:52.011970+0100 Runner[32021:139410] flutter: #12     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
    2020-02-07 10:49:52.012203+0100 Runner[32021:139410] flutter: #13     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
    2020-02-07 10:49:52.012346+0100 Runner[32021:139410] flutter: #17     _invoke1 (dart:ui/hooks.dart:273:10)
    2020-02-07 10:49:52.012806+0100 Runner[32021:139410] flutter: #18     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
    2020-02-07 10:49:52.012924+0100 Runner[32021:139410] flutter: (elided 3 frames from package dart:async)
    2020-02-07 10:49:52.013019+0100 Runner[32021:139410] flutter:
    2020-02-07 10:49:52.013112+0100 Runner[32021:139410] flutter: Handler: "onTap"
    2020-02-07 10:49:52.013202+0100 Runner[32021:139410] flutter: Recognizer:
    2020-02-07 10:49:52.013695+0100 Runner[32021:139410] flutter:   TapGestureRecognizer#89339
    2020-02-07 10:49:52.014395+0100 Runner[32021:139410] flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
    2020-02-07 10:49:52.086067+0100 Runner[32021:139410] flutter: firebase_crashlytics: Error reported to Crashlytics.
    2020-02-07 10:49:52.739934+0100 Runner[32021:139410] flutter: Flutter error caught by Crashlytics plugin:
    2020-02-07 10:49:52.743795+0100 Runner[32021:139410] flutter: ══║ EXCEPTION CAUGHT BY GESTURE β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
    2020-02-07 10:49:52.743983+0100 Runner[32021:139410] flutter: The following StateError was thrown while handling a gesture:
    2020-02-07 10:49:52.744139+0100 Runner[32021:139410] flutter: Bad state: Error thrown by Crashlytics plugin
    2020-02-07 10:49:52.744313+0100 Runner[32021:139410] flutter:
    2020-02-07 10:49:52.744542+0100 Runner[32021:139410] flutter: When the exception was thrown, this was the stack:
    2020-02-07 10:49:52.744708+0100 Runner[32021:139410] flutter: #0      Crashlytics.crash (package:firebase_crashlytics/src/firebase_crashlytics.dart:54:5)
    2020-02-07 10:49:52.744848+0100 Runner[32021:139410] flutter: #1      _InformationPageState.build.<anonymous closure> (package:mainapp/pages/informationpage.dart:71:42)
    2020-02-07 10:49:52.744946+0100 Runner[32021:139410] flutter: #2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
    2020-02-07 10:49:52.745148+0100 Runner[32021:139410] flutter: #3      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789:36)
    2020-02-07 10:49:52.751009+0100 Runner[32021:139410] flutter: #4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
    2020-02-07 10:49:52.751514+0100 Runner[32021:139410] flutter: #5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
    2020-02-07 10:49:52.751758+0100 Runner[32021:139410] flutter: #6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
    2020-02-07 10:49:52.752005+0100 Runner[32021:139410] flutter: #7      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
    2020-02-07 10:49:52.752543+0100 Runner[32021:139410] flutter: #8      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
    2020-02-07 10:49:52.753430+0100 Runner[32021:139410] flutter: #9      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
    2020-02-07 10:49:52.753672+0100 Runner[32021:139410] flutter: #10     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
    2020-02-07 10:49:52.755470+0100 Runner[32021:139410] flutter: #11     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
    2020-02-07 10:49:52.755806+0100 Runner[32021:139410] flutter: #12     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
    2020-02-07 10:49:52.756565+0100 Runner[32021:139410] flutter: #13     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
    2020-02-07 10:49:52.757056+0100 Runner[32021:139410] flutter: #17     _invoke1 (dart:ui/hooks.dart:273:10)
    2020-02-07 10:49:52.757240+0100 Runner[32021:139410] flutter: #18     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
    2020-02-07 10:49:52.757838+0100 Runner[32021:139410] flutter: (elided 3 frames from package dart:async)
    2020-02-07 10:49:52.758046+0100 Runner[32021:139410] flutter:
    

    Result: enter image description here

    Edit1: If I look into project.pbxproj, in their example https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_crashlytics/example/ios/Runner.xcodeproj/project.pbxproj it says:

    inputPaths = ( "$(SRCROOT)/newInputFile", );

    while mine says:

    inputPaths = ( "$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)", );

    which is according to their documentation https://pub.dev/packages/firebase_crashlytics .Could that be the reason?

  • Viktor Morin
    Viktor Morin about 4 years
    GoogleService-Info.plist is located at appName\ios\runner\GoogleService-Info.plist, and I can see in analytics on Firebase dashboard, number of installations for iOS so I guess that works. I have also waited more then 1 day (Android shows up after 5 min usally)
  • Viktor Morin
    Viktor Morin about 4 years
    I have tried both with and without $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH). I'm running the simulator on a VM, but don't have any software installed. Could it be blocked by default by macOS? I have also crashed the application on a real device without any logs.
  • Viktor Morin
    Viktor Morin about 4 years
    Do you have a working solution with Flutter and Crashlytics for iOS?
  • user5269602
    user5269602 about 4 years
    Working example is here github.com/FirebaseExtended/flutterfire/tree/master/packagesβ€Œβ€‹/… If you follow the docs and that example it will work.
  • Viktor Morin
    Viktor Morin about 4 years
    I have followed that example, without any success for iOS
  • Andrey Solera
    Andrey Solera almost 4 years
    @ViktorMorin have you found a solution?
  • Viktor Morin
    Viktor Morin almost 4 years
    @Andrey I have it up and running, see my accepted answer
  • Rohmatul Laily
    Rohmatul Laily over 2 years
    this is work for me after run release mode