简体   繁体   English

如何在 Crashlytics/Flutter (Android) 中查看 Dart 代码堆栈跟踪而不是 Java 代码堆栈跟踪

[英]How to see Dart code stack trace instead of Java code stack trace in Crashlytics/Flutter (Android)

We are using the firebase_crashlytics plugin for Flutter to get error reports in Crashlytics.我们正在使用 Flutter 的firebase_crashlytics插件来获取 Crashlytics 中的错误报告。 Unfortunately for Android, only the non-fatal issues show a proper Dart code stack trace.不幸的是,对于 Android,只有非致命问题显示了正确的 Dart 代码堆栈跟踪。 The fatal issues only show Java code stack trace which makes them very hard to debug.致命问题仅显示 Java 代码堆栈跟踪,这使得它们很难调试。

Is there any way to get proper Dart code stack traces for fatal issues as well?有没有什么方法可以为致命问题获得正确的 Dart 代码堆栈跟踪?

I added this lines to my main.dart to get the Dart StackTrace:我将此行添加到我的main.dart以获取 Dart StackTrace:

FlutterError.onError = (error) => flutterErrorHandler(error);

runZonedGuarded<Future<void>>(
    () async => runApp(
      YourAppWidget(),
    ),
    (error, strack) async {
      debugPrint(error.toString());
      // Whenever an error occurs, call the `reportCrash`
      // to send Dart errors to Crashlytics
      Crashlytics.instance.recordError(error, strack);
    },
  );
void flutterErrorHandler(FlutterErrorDetails details) {
  FlutterError.dumpErrorToConsole(details);

  // Report to the application zone to report to Crashlytics.
  Zone.current.handleUncaughtError(details.exception, details.stack);
}

For more details see: https://pub.dev/packages/firebase_crashlytics有关更多详细信息,请参阅: https://pub.dev/packages/firebase_crashlytics

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter Firebase Crashlytics 将堆栈跟踪报告为 Java 类文件而不是 Dart 文件 - Flutter Firebase Crashlytics reports stack trace as Java class files and not as Dart files 堆栈跟踪反混淆:带有ProGuard和Crashlytics的Android Studio - Stack trace deobfuscation: Android Studio with ProGuard and Crashlytics 无法在 Crashlytics 中获取本机崩溃的堆栈跟踪 - Unable to get stack trace for native crashes in Crashlytics Flutter Firebase 无法理解堆栈跟踪 - Flutter Firebase unable to understand stack trace 使用 firebase Crashlytics 进行 React Native 错误记录 - 如何获取 javascript 堆栈跟踪 - React Native error logging with firebase Crashlytics - How to get javascript stack trace 反应本机堆栈跟踪 - React Native Stack Trace 如何在原始堆栈跟踪的位置集中记录异常? - How to log exception centrally at place of original stack trace? Flutter:如果我使用 Dart 代码混淆,Crashlytics 是否仍然有效? - Flutter: Will Crashlytics still work if I use Dart Code Obfuscation? Firebase崩溃报告包含带有<OR>的堆栈跟踪 - Firebase crash report contains stack trace with <OR> 堆栈跟踪错误仍然显示在我的控制台上 - Stack trace error is still showing up on my console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM