SocketTimeoutException android retrofit

laibowon 2017-11-27

解决办法:把socket的超时时间设置的长一些。

private OkHttpClient getClient() {
  OkHttpClient client = new OkHttpClient.Builder()
    .connectTimeout(5, TimeUnit.MINUTES)
    .readTimeout(5, TimeUnit.MINUTES)
    .build();
  return client;
}

相关推荐