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

后端 未结 3 1755
时光说笑
时光说笑 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();
    
    0 讨论(0)
  • 2020-12-19 12:15

    This is a known issue:

    https://github.com/square/retrofit/issues/397

    Did you try using OkHttp?

    0 讨论(0)
  • 2020-12-19 12:39

    Check your internet connection, use a real device and test the app

    0 讨论(0)
提交回复
热议问题