from : http://blog.csdn.net/x707669224/article/details/56280270
解决okhttp 报java.lang.IllegalStateException: closed,java.lang.IllegalStateException: closed,原因为OkHttp请求回调中response.body().string()只能有效调用一次
在调用了response.body().string()方法之后,response中的流会被关闭,我们需要创建出一个新的response给应用层处理。不多说直接贴代码:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13