简体   繁体   中英

How to get full stack trace of Dart Isolate error

I'm having problems to build a Flutter app in an Android device. The error bellow happens whenever I try to override current version, downloaded from Google Play Store, with new debug version.

But it is very hard to find where the problem is, because I can't see the whole stack trace.

Whenever this error happens, the version from Google Play Store is not replaced with my debug version and Flutter framework is not even "started", I can't use hot reload and so on.

I tried already to run in verbose mode, but I still don't get the full stack trace.

Here is what I get in the console:

I/flutter (16724): 7 has been spawned
I/flutter (16724): initialized
I/flutter (16724): inserted task with number -9007199254740992
I/flutter (16724): isolate with task number -9007199254740992 begins work
I/flutter (16724): inserted task with number -9007199254740991
I/flutter (16724): isolate with task number -9007199254740991 begins work
E/flutter (16724): [ERROR:flutter/runtime/dart_isolate.cc(1137)] Unhandled exception:
E/flutter (16724): Null check operator used on a null value
E/flutter (16724): Warning: This VM has been configured to produce stack traces that violate the Dart standard.
E/flutter (16724): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/flutter (16724): pid: 16724, tid: 16793, name DartWorker
E/flutter (16724): build_id: '45d66c9fd13d70ae4850c9cfde54f16d'
E/flutter (16724): isolate_dso_base: 7864010000, vm_dso_base: 7864010000
E/flutter (16724): isolate_instructions: 786401f000, vm_instructions: 7864012000
E/flutter (16724):     #00 abs 000000786408b66f virt 000000000007b66f _kDartIsolateSnapshotInstructions+0x6c66f
E/flutter (16724):     #01 abs 000000786408af93 virt 000000000007af93 _kDartIsolateSnapshotInstructions+0x6bf93
E/flutter (16724):     #02 abs 00000078645764db virt 00000000005664db _kDartIsolateSnapshotInstructions+0x5574db
E/flutter (16724):     #03 abs 00000078641bc64f virt 00000000001ac64f _kDartIsolateSnapshotInstructions+0x19d64f
E/flutter (16724):     #04 abs 00000078641bc58f virt 00000000001ac58f _kDartIsolateSnapshotInstructions+0x19d58f
E/flutter (16724):     #05 abs 00000078641bbe77 virt 00000000001abe77 _kDartIsolateSnapshotInstructions+0x19ce77
E/flutter (16724):     #06 abs 00000078641bc73b virt 00000000001ac73b _kDartIsolateSnapshotInstructions+0x19d73b
E/flutter (16724):     #07 abs 00000078641bb8af virt 00000000001ab8af _kDartIsolateSnapshotInstructions+0x19c8af
E/flutter (16724):     #08 abs 00000078641bd513 virt 00000000001ad513 _kDartIsolateSnapshotInstructions+0x19e513
E/flutter (16724): <asynchronous suspension>
E/flutter (16724):     #09 abs 000000786422e3b7 virt 000000000021e3b7 _kDartIsolateSnapshotInstructions+0x20f3b7
E/flutter (16724): <asynchronous suspension>
E/flutter (16724):     #10 abs 000000786422dda7 virt 000000000021dda7 _kDartIsolateSnapshotInstructions+0x20eda7
E/flutter (16724): <asynchronous suspension>
E/flutter (16724):     #11 abs 000000786422efcf virt 000000000021efcf _kDartIsolateSnapshotInstructions+0x20ffcf
E/flutter (16724): <asynchronous suspension>
E/flutter (16724):     #12 abs 00000078641c0193 virt 00000000001b0193 _kDartIsolateSnapshotInstructions+0x1a1193
E/flutter (16724): <asynchronous suspension>

Here is also my flutter doctor result, in case it helps:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.3 20E232 darwin-x64, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] Connected device (2 available)

• No issues found!

Thank you, any info would help.

The null pointer dereference inside of isolate is probably because of platform channels are not supported in isolates:

https://github.com/flutter/flutter/issues/13937

Unfortunately there are not enough logs to prove.

Answering my own question for those who may face the same issue in the future.

TL;DR

flutter logs seems to show the full stack trace of the original error.

Here is the step by step that workd in this special case:

  1. Build the apk with flutter build apk
  2. Install it via adb adb install./build/app/outputs/flutter-apk/app-release.apk
  3. Run flutter logs , and start the application in the Android device

The full stack trace is showed like the example below:

E/flutter (14880): [ERROR:flutter/runtime/dart_isolate.cc(1137)] Unhandled exception:
E/flutter (14880): Null check operator used on a null value
E/flutter (14880): #0      MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:142)
E/flutter (14880): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:148)
E/flutter (14880): #2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:331)
E/flutter (14880): #3      new FirebasePerformance._ (package:firebase_performance/src/firebase_performance.dart:16)
E/flutter (14880): #4      FirebasePerformance.instance (package:firebase_performance/src/firebase_performance.dart:32)
E/flutter (14880): #5      Performance.traceFunction (package:app/resources/performance.dart)
E/flutter (14880): #6      Performance.traceFuture (package:app/resources/performance.dart:13)

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