Android app crashes when launched in debug mode

ID : 10392

viewed : 30

Tags : androidandroid-studiodebuggingandroid-debugandroid-debuggingandroid

Top 5 Answer for Android app crashes when launched in debug mode

vote vote


For me, it occurred when I have a breakpoint in a nested function. In my case, it was within {}. Not sure if it happens in other nested functions.


public class TouchEvent {     public boolean HandleEvent(MotionEvent Event) {         new Runnable() { @Override public void run() {             int i=5;             i++;         }};     } } 

If there is a breakpoint on any line inside the run() func, it crashes with the error A/art: art/runtime/jdwp/] Check failed: Thread::Current() != GetDebugThread() (Thread::Current()=0x########, GetDebugThread()=0x########) Expected event thread .

This error occurs the first time the class is encountered, NOT when the breakpoint is hit. So it occurred for me when I stepped into a line that had new TouchEvent();, before any of the TouchEvent's code was run (before the constructor).

The solution is to remove the break point (and put it elsewhere).


Forgot to mention, it seems to be tied to API25, but has been reported for API26 and API27 too.


Another solution is to disabled Instant Run, but please give @toobsco42 credit for that below.

vote vote


In my case i had to disable Instant Run. It seems like Instant Run has all sorts of side effects and this can be one of them.

vote vote


Problem is related with Android version 7.x, i removed all the breakpoints in nested functions and it worked, tested with Android version 6.0 too, and it is working without problem.

According to google developers team response, it was fixed on 12/1/2016 and will be applied in next release.

vote vote


I removed all the breakpoints and it worked, tested with Emulator Pixel API 25.

To remove all breakpoints:

  • Go to Debugger option.

  • Click on red icon which is below to stop debug.

  • You will see a window there you can remove all breakpoints.

See more in this post:

vote vote


This is due to some problem with debug points. Remove all the debug points and then it should work.

Top 3 video Explaining Android app crashes when launched in debug mode