[英]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.