Lisa Anne
Lisa Anne

Reputation: 4595

IntelliJ/Android Studio debugging: Breakpoint in callback does not get called

I am using Retrofit in my Application, like this:

    beforeFubar();
    MyRetrofitApi.getFoo(new Callback<Foo>() {
        @Override
        public void success(Foo arg0, Response arg1) {
        successFubar();

        }

        @Override
        public void failure(RetrofitError arg0) {
        failureFubar(); 
        }
    });

I put my breakpoints at

Breakpoint at beforeFubar() gets called correctly and executions stops

BUT

Breakpoints at successFubar() and failureFubar() do not get called (but they are executed)

Please, what am I missing here?


EDIT

it seems that the issue gets solved if I set Suspend All when I set the breakpoint.

Please what is your experience? Does this solve the problem?

enter image description here

Upvotes: 10

Views: 1960

Answers (3)

Mosayeb Masoumi
Mosayeb Masoumi

Reputation: 583

just update classpath 'com.android.tools.build:gradle:4.1.2' to the latest version if it dosent work , you must upgrade your android studio to the latest version

Upvotes: 0

Shawn Azdam
Shawn Azdam

Reputation: 6160

Because of your ADB (Android Debug Bridge) configuration and settings this problem may happen.

Manipulate following solutions according to your conditions:

  • If you debug your app on a test device through WiFi switch to USB
  • If you debug on an AVD, try to Restart AS and then reestablish again
  • Restart adb server with the following commands and also your PC:

adb kill-server

adb start-server

Upvotes: 0

Viral Patel
Viral Patel

Reputation: 33398

Similar issue was reported in the past and seems to get fixed by adding a call to waitForDebugger() just prior to the line with the breakpoint active.

Source : How to debug android callbacks?

Upvotes: 1

Related Questions