androidandroid-studioandroid-emulatorretrofit2android-debug

Android Studio debugger doesn't stop at Retrofit callback breakpoints on devices running API 29 Android 10 and API 30 Android 11


I am using Android Studio 4.1 Build #AI-201.8743.12.41.6858069, built on September 23, 2020

When debugging the below code snippet, the debugger never stops at the lines in the onSuccess callback of Retrofit, even though the call is successful and the response data is shown in the UI.

enter image description here

N.B This issue is only present on real (Samsung Tab A 2019, Android 10) and Android studio Emulators running Android 10 API 29 and Android 11 API 30 according to my tests (Done on 2 different PCs). This is causing huge confusion in the debugging process. What is even weirder is that on some random occasions, the debugger stops on the breakpoints! But, you have to try it out like 7 or 8 consecutive times, and you will get lucky once!

P.S I have tested the same code on physical and android studio emulators from API 21 till 28 and the debugger stops at the proper breakpoints in the callbacks of Retrofit. (Works perfectly)

Here is a link to a sample project containing this code snippet on Github. You can try it on your machines and see for yourselves after placing the breakpoints the same as they are placed in the screenshot in "MainActivity.java". If anyone gets different results, please share.


Update: The debugger doesn't stop not only on Retrofit callback methods but if you override any interface method, the debugger will not stop at breakpoints inside these methods.


Solution

  • I was facing the same issue. After updating android studio 4.1.1 breakpoints in callback start working.