Retrofit2.0使用过程中遇到的问题
Retrofit在进行异步的网络请求时,代码如下:
Call<Post_BeaconResult> call = api.PostForm_foots(foots, share_get_loginticket, ts, qianmingcode); call.enqueue(new Callback<Post_BeaconResult>() { @Override public void onResponse(Call<Post_BeaconResult> call, Response<Post_BeaconResult> response) { String s = response.body().toString(); } @Override public void onFailure(Call<Post_BeaconResult> call, Throwable t) { LogUtil.d("&&&&&错误", t.getMessage().toString()); } });可能会抛出异常: RETROFIT: Use JsonReader.setLenient(true) to accept malformed JSON at line 1
我的解决办法是:在Module:app中添加
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'