解决okhttp的java.lang.IllegalStateException: closed错误

 错误如下

 

原因为OkHttp请求回调中response.body().string()只能有效调用一次,而我使用了两次:

String result = response.body().string();
Log.e(TAG, "onResponse - " + response.body().string() );//打印时又使用了一次

 

posted @ 2018-08-09 14:38  Sharley  阅读(1636)  评论(0编辑  收藏  举报