Android studio keeps jumping over/not hitting breakpoints

Issue

I’m experiencing random behavior in android studio (4.1.1). When hitting debug (Shift + F9) the first breakpoints are being hit but sometimes when stepping through code (F8), there is some lag and chunks of 5, 10 lines are jumped over in quick succession.

Sometimes, when resuming execution (F9), breakpoints that are supposed to be hit (button handlers (same buttons pressed)) are no longer hit even they were hit on the first run.

I thought it to be related to win defender scanning(hooking writes to) the project dir but it seems that’s not the case.

Anyone else struggling with this?

Solution

It may be caused by code running on different threads. Right click on the breakpoint and switch from Thread to All, see the screenshot below.

breakpoint thread

Answered By – Jameido

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published