-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.IllegalStateException: closed #22
Comments
I found out that in my case raised error "android.os.NetworkOnMainThreadException" because of reading of response body in the httpOk callback, that executes in main thread. |
I think this could work then.
or a null check for body... |
But, as I said earlier, the second reads of response body it is not a cause, it is a consequence of threw android.os.NetworkOnMainThreadException, because of IO operation on the main thread(The callback is made after the response headers are ready, so response body reading is a IO operation). Seems, that one way to resolve this issue it read response body in separate thread e.g. AsyncTask.
|
@wolfchkov a temp workaround, can you try ?
|
It works for me as workaround. |
This error occur when read okhttp3.response.body() more then one time, because it is stream, after first read it is closing.
The text was updated successfully, but these errors were encountered: