androidandroid-studioadbandroid-debug

Android Studio - Slow debug, sometimes stuck on "Waiting for debugger", SIGSEGV crashes


This may come out as too broad a question, but this issue(s) is driving me nuts and I'd appreciate some help:

It seems that with each new Android Studio version, debugging gets more and more impossible. I'm experiencing the following issues:

  1. Very slow debugging overall. Stepping over is a drag.
  2. A high precentage of failed debugger connection attempts, where the device is hanging on "Waiting for debugger".
  3. SIGSEGV "crashes", where the debugger would halt on a SIGSEGV on a random place (ususally right after launch) but I'd be able to click the play button and continue debugging.
  4. Debugger disconnections.

This happens both on real devices and emulators, with a wide range of setups and Android API levels.

My rig is quite powerful: Win 10, I7-4810MQ, 16g mem, SSD. Current AS version is 2.3.3.

Can anyone help me make some sense out of this mess?


Solution

  • It turns out the culprit was me using JDK 8 (1.8.0_45). I guess the situation did indeed begin deteriorating with Android Studio 2.2, when Google made the switch to OpenJDK.

    The fix was to simply let Android Studio use its own JRE, which is based on the OpenJDK project.

    In File -> Project structure -> SDK location, I had to tick Use embedded JDK: enter image description here

    Now I have to deal with the actual bugs in my app, but this is a whole different story...