我正在使用改装-betal2,我不时会遇到以下崩溃。我不确定我做错了什么。如果有人能给我一个解决问题的提示,那就太好了。
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)
正如this问题所述,有两种可能性:
OkHttp有一个错误,我们试图在不应该的时候恢复 因为我们已经用尽了所有可用的路线。
OkHttp有一个错误,你有一个自定义的DNS实现 为主机返回零IP地址,我们没有拒绝。
我的建议是使用新版本的改装和okhttp,因为Retrofit 2已经发布。
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.squareup.retrofit2:retrofit:2.0.0'