2016-03-30 3 views
0

Я использую retrofit-beta2, и время от времени я получаю крах ниже. Не уверен, что я делаю неправильно. Было бы здорово, если бы кто-нибудь мог дать мне подсказку об устранении проблемы.Модернизация: Получение java.util.NoSuchElementException иногда

Fatal Exception: java.util.NoSuchElementException 
      at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:79) 
      at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:164) 
      at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) 
      at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) 
      at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:283) 
      at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) 
      at com.squareup.okhttp.Call.getResponse(Call.java:286) 
      at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243) 
      at com.squareup.okhttp.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:204) 
      at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:232) 
      at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205) 
      at com.squareup.okhttp.Call.access$100(Call.java:35) 
      at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:171) 
      at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) 
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
      at java.lang.Thread.run(Thread.java:818) 
+0

сделал это работает, когда вы используете другие версии, как '1.9' или что-нибудь еще –

+0

код полностью отличается от' 1.9' версия не так ... причем эта ошибка возникает только в редких случаях ... Мне сложно отслеживать причину :( –

+0

вы имеете в виду когда-нибудь это работает, а когда-то нет. –

ответ

1

Как сказано в this вопросе есть две возможности:

OkHttp есть ошибка, когда мы пытаемся восстановить, когда мы не должны быть потому, что мы исчерпали все имеющиеся маршруты.

У OkHttp есть ошибка, в которой у вас есть пользовательская реализация DNS, которая вернула нулевые IP-адреса для хоста, и мы не отказались от этого.

Мое предложение состоит в том, чтобы использовать новые версии retrofit и okhttp, потому что Retrofit 2 уже выпущен.

compile 'com.squareup.okhttp3:okhttp:3.1.2' 
compile 'com.squareup.retrofit2:retrofit:2.0.0' 
Смежные вопросы