I have a Android/iOS app developed using Flutter
through Visual Studio Code. When I run it on Android >=5.0 or any version of iOS it works flawlessly, however it crashes immediately when I run it on Android 4.x (Unfortunately, app has stopped).
I want to fix it, but Flutter
doesn't show me what is happening.
I tried to run through VSCode pushing F5 button and also using command line flutter run
, but neither shows me something that I could work with. I tried to run with trace
command [Flutter trace run]
, but it says The --debug-port argument must be specified
and I don't know what it means.
I just need a stacktrace or a line error showing me what is the problem. Do I have to configure something on VSCode?
You can obtain a stack trace from a thread – by calling the getStackTrace method on that Thread instance. This invocation returns an array of StackTraceElement, from which details about stack frames of the thread can be extracted.
Using printStackTrace() method − It print the name of the exception, description and complete stack trace including the line where exception occurred. Using toString() method − It prints the name and description of the exception. Using getMessage() method − Mostly used. It prints the description of the exception.
A StackTrace is intended to convey information to the user about the call sequence that triggered an exception. These objects are created by the runtime, it is not possible to create them programmatically.
There's a Debug Console available in Visual Studio Code as per checking version 1.51.1. This can be enabled/disabled by navigating through the menu View > Debug Console
. Both logs from Android emulator and iOS simulator can be displayed on the Debug Console.
However, if you're looking into checking Flutter debug logs outside of Visual Studio Code, the adb logcat
command using the terminal works well for Android as previously mentioned in the comments.
On iOS, one way of checking the logs is through the Console. Press ⌘ + space and type "Console", and press Enter to launch the app. The iOS device should be displayed on the left-side pane of the Console app under Devices
. Clicking on the iOS device should display its logs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With