Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

  • beforeFubar(),
  • successFubar()
  • failureFubar()

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

like image 237
Lisa Anne Avatar asked Jan 13 '16 07:01

Lisa Anne


1 Answers

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?

like image 119
AndroidMechanic - Viral Patel Avatar answered Oct 13 '22 00:10

AndroidMechanic - Viral Patel