java.lang.IllegalStateException: closed when trying to access response in onResponse(Response respo
来源:互联网 发布:ne80e端口物理层down 编辑:程序博客网 时间:2024/05/16 10:52
在使用okhttp成功接收json数据后进行打印log:
@Override
public void onResponse(Response response) throws IOException {
// Log.i(“log”, ” onResponse() reuslt=” + response.body().string());
JSONObject jsonobject =JSON.parseObject(response.body().string());
Log.d(“log”,”数据成功 码:”+jsonobject.get(“code”));
}
错误原因:由于某处两次都调用了response.body().string();
导致closed,有且只能调用一次
错:
09-13 17:41:22.763 19725-21188/mhwh.wow E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: mhwh.wow, PID: 19725
java.lang.IllegalStateException: closed
at com.squareup.okhttp.internal.http.HttpConnection
at com.squareup.okhttp.Call
at java.lang.Thread.run(Thread.java:841)
- java.lang.IllegalStateException: closed when trying to access response in onResponse(Response respo
- java.lang.IllegalStateException: closed when trying to access response in onResponse(Response respon
- response.sendRedirect java.lang.IllegalStateException
- response.sendRedirect java.lang.IllegalStateException
- android java.lang.IllegalStateException: trying to requery an already closed cursor
- OKHttp用法小结,response的巨坑,java.lang.IllegalStateException: closed
- Cursor获取的时候有异常的处理 java.lang.IllegalStateException: trying to requery an already closed cursor
- java.lang.IllegalStateException: closed
- ava.lang.IllegalStateException: It is invalid to call isReady() when the response has not been put i
- Httpclient中 Exception in thread "main" java.lang.IllegalStateException: Response content has been al
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Response has already been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- Java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- 从头搭建eclipse javaee环境
- Educational Codeforces Round 10 C. Foe Pairs
- C#保留指定的小数个数,不四舍五入
- 第7章 后台服务程序
- ATSHA204A加密芯片之--MAC校验代码
- java.lang.IllegalStateException: closed when trying to access response in onResponse(Response respo
- 图像处理经典文献
- android 存储系统架构
- Chart: 计算X轴标签个数1 (错误的分析)
- 深入了解View(一)——LayoutInflater原理分析
- 第9章 TIGER VNC远程登陆配置
- 文本分类入门
- 如何知道dll文件是32位还是64位
- PrimeNG is updated to 1.0.0-beta.15 with Angular2 RC6 support