I have an Android SDK that uses OkHttp. In my example application that uses my SDK, everything works fine. However, one of my users, when StrictMode is turned on, gets the following java.lang.Throwable: Explicit termination method 'close' not called . I tried to replicate this in my own application using StrictMode and not get this error.
I understand that I should call response.body().close() , but I'm still a little confused why this is not happening in my application. The stack trace he sent me only contains my classes, so it doesn't seem like something in his code calls it.
It should also be noted that only one of the requests that my SDK makes really has a response read. But this is not a request that my user says throws an exception.
Is there anything else that can cause this?
When should I call .close() ? Call it expedient after calling execute() ? Can closing the body prevent it from reading in the future?
tbeauvais
source share