bug retrofit.RetrofitError: java.io.EOFException for Android

后端 未结 3 1759
时光说笑
时光说笑 2020-12-19 11:38

I search a lot, I found some solutions like this:

System.setProperty(\"http.keepAlive\", \"false\");
arg0.addHeader(\"Connection\", \"close\");
arg0.addHeade         


        
3条回答
  •  情深已故
    2020-12-19 12:12

    I finally resolve the problem. Like mromer said, the solution was to use both OkClient and OkHttp. After adding these two libraries I set the client on Retrofit to OkHttp like that:

    RestAdapter restAdapter = new RestAdapter.Builder()
        .setErrorHandler(new ErrorRetrofitHandlerException())
        .setEndpoint(urlBase)
        .setLogLevel(RestAdapter.LogLevel.FULL)
        .setClient(new OkClient(new OkHttpClient()))
        .build();
    

提交回复
热议问题