Polarfox
Polarfox

Reputation: 171

No Stacktrace in AndroidStudio

I´m trying to debug an android app that I´m writing and found out that there is no exception stack trace written to the console / logcat / messages. I tried to remove the .gradle folder and restarted android-studio, how some post recommend, but it didn´t help me.

I use Android Studio 2.3.1 and tested with a virtual Nexus 5X API 25 and a real Huawei P9 lite with Android 6.0. Problem exists for both devices.

The problem continues to exist also if I remove the google play service dependency.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-maps:10.2.4'
}

My problem seems a bit like this one, but there was no answer for that question: AndroidStudio no stacktrace shown after app crash

I can find bugs with breakpoints, but this costs me five times more time, then just reading what exception is thrown where.

By the way: the console prints just Log.e messages not Log.d.

Upvotes: 1

Views: 2763

Answers (4)

Mateut Alin
Mateut Alin

Reputation: 1295

If you are using linux, open a console and type

adb start-server

and above logcat tab switch to the new emulator

Upvotes: 1

Zoe - Save the data dump
Zoe - Save the data dump

Reputation: 28228

First, reboot your device and try to trigger the error. IF that does not work, press the bottom button that looks like a redo-button with a stop-icon on it:

This restarts the Logcat, it does wipe the current log entries showing, but that should show the error when you trigger it.

Upvotes: 1

Mick
Mick

Reputation: 25471

I have seen this issue frequently also.

In my case it was usually caused by the device I was testing on restarting the process/app. This meant that the current view in logcat was for the new process and not the one with the error I wanted.

If you look at the logical window you will see you can actually select the process from the dropdown box - the one you are looking for will probably be there with 'DEAD' after it.

You can see an example here:

enter image description here

Upvotes: 0

Björn Kechel
Björn Kechel

Reputation: 8463

I have the same happening sometimes. It seems like Android Studio thinks it starts a new debug session and does not show the old logs anymore. In that case I change the monitor settings:

  1. in the dropdown on the right I choose "No filters"
  2. in the dropdown on the left to the search box I choose "Warn" or "Error"

That way I see all error/warn log entries, and sure enough, if there was none after a crash before, it usually appears with these settings.

Do not forget to change back to the preferred settings afterwards.

Upvotes: 5

Related Questions