Retrofit 的使用参考,可以在这里查看 http://blog.csdn.net/aka_GZ/article/details/52447777
按照网上配置请求之并未成功拿到数据,
查看错误信息后发现出现这个异常 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: closed
经过排查,原因是因为在拦截器里面 ,打印了请求体,有说法是, response.body() 只能调用一次,再次调用会出现状态异常
看来想打印请求信息,需要另求它法了
//网络拦截器 client.networkInterceptors().add(new Interceptor() { @Override public com.squareup.okhttp.Response intercept(Chain chain) throws IOException { Request request=chain.request(); com.squareup.okhttp.Response response = chain.proceed(request); Log.e("weiquan",""+request.httpUrl()+" "+request.headers()+" "+response.body().string()); return response; } });