android studio error disappears in logCat after crash

8.3k Views Asked by At

My app is crashing. For a split second the error appears in the logcat but then very quickly gets replaced by a bunch of garbage. How do I find my error? My error seem to scroll off so quickly that I cannot find it.

5

There are 5 best solutions below

2
On

At the top right of your Log Cat Box you should see a dropdown selector that says "Log Level: Verbose" select this and select "Error". This should filter out any non-error logs so all you have to do is scroll up to find the one your looking for.

Hope this helps - Kevin Grout

0
On

In my experience, I just discovered that I have this option available in the logcat each time my app crashes (See image). Even if it crashes, it will display the default app package name (the one with the yellow arrow). So you will have to select the package name [DEAD] option from the dropdown (with Yellow Check) and then select ERROR (encircled in blue). and the errors should display.

logcat_screenshot

0
On

I noticed that the run tab showcase all the logs ,even when some of it disappears from the logcat after a crash . it is especially useful when using the avd emulators which has a limited memory for the log output in the logcat tab. in edition , one can find logs file in the top menu : help -> show logs in explorer.

0
On

You can use the debugger mode (debugger android studio) . Just put a breakpoint in a method which is executed before the crash happen. Then you can follow the process by pressing the "step over" icon until the crash happens. You should be able to consult the crash report in the Logcat.

0
On

Currently I filter logs in Logcat so (insert you package name):

enter image description here

Check that you selected "No filters" in the right box. Sometimes it will be useful to change to other options (like "Firebase", "Show only selected application") and return to "No filters". Maybe wait for 5-10 seconds.

I found that Pixel 2 emulator with Android 5 (API 21) didn't show logs. So, it would be better to create Nexus 5/5X emulators instead.

Also there is another way. See Android Studio, logcat cleans after app closes.

In AndroidStudio, the default setting for the Logcat window seems to be "Show only selected Application" (top right corner of the Logcat window)... which is looking at the log of the selected process (your current launch by default). So when your app crashes during testing, that process is gone, so the filter clears the log.

Instead, select "Edit Filter Configuration..." and set up a filter for your app, eg:

  • FilterName: MyApp
  • PackageName: com.example.myapp (<< replace with your app's package name)

...and then select that filter for future runs. This should keep the log there for you, even after the app crashes.

So you can write your package name inside a Log Message field. To do this, in LogCat press Edit Filter Configuration

enter image description here

and set log message:

enter image description here