简体   繁体   中英

Flutter Firebase Crashlytics reports stack trace as Java class files and not as Dart files

I have integrated Flutter Crashlytics in our app, but it is reporting crashes stack trace in Java class files and not in Dart files. So it is difficult to infer what is the file and line number where this issue occurred in the flutter codebase.

Here is an example of one such crash report from Firebase Crashltytics of an Uncaught exception:

Non-fatal Exception: java.lang.Exception: NoSuchMethodError: The method 'markNeedsBuild' was called on null.
Receiver: null
Tried calling: markNeedsBuild()
       at State.setState(State.java:1168)
       at _ArgonButtonState.initState.<fn>(initState.java:107)
       at AnimationLocalStatusListenersMixin.notifyStatusListeners(AnimationLocalStatusListenersMixin.java:193)
       at AnimationController._checkStatusChanged(AnimationController.java:773)
       at AnimationController._tick(AnimationController.java:789)
       at Ticker._tick(Ticker.java:237)
       at SchedulerBinding._invokeFrameCallback(SchedulerBinding.java:1102)
       at SchedulerBinding.handleBeginFrame.<fn>(handleBeginFrame.java:1017)
       at SchedulerBinding.handleBeginFrame(SchedulerBinding.java:1015)
       at SchedulerBinding._handleBeginFrame(SchedulerBinding.java:949)

Here is how Crashlytics is initialized:

// Pass all uncaught errors from the framework to Crashlytics.
FlutterError.onError = Crashlytics.instance.recordFlutterError;

runZoned(() {
    runApp(AppMain(homeWidget));
  }, onError: Crashlytics.instance.recordError);

I am reporting caught exceptions as such:

Crashlytics.instance.recordError(error, stack);

How can I configure Crashlytics to report stack trace in dart? Does Crashlytics show erroneous file names and line numbers for Dart source code?

Todd from Crashlytics. This is a known behavior and we are looking into possible options moving forward. Kotlin users will see a similar behavior.

I would suggest to move on to Sentry. I am doing it for my app now. And while just testing it, I can say that sentry is much better than Crashlytics!

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