【发布时间】:2015-01-14 06:22:29
【问题描述】:
大家中午好!
我在我的应用程序中使用Retrofit 进行网络调用。该应用程序运行良好,速度很快。感谢精彩的图书馆。但是,它只能在 wi-fi 中工作。如果我在 3G 网络中运行该应用程序,则会引发错误。 stream was reset: PROTOCOL_ERROR, while using Retrofit in 3G network
我已将此 jar 文件导入构建路径:
这是完整的堆栈跟踪:
11-17 16:01:54.017: D/Retrofit(3595): java.io.IOException: stream was reset: PROTOCOL_ERROR
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.spdy.SpdyStream.getResponseHeaders(SpdyStream.java:146)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.http.SpdyTransport.readResponseHeaders(SpdyTransport.java:109)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:676)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:426)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
11-17 16:01:54.017: D/Retrofit(3595): at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
11-17 16:01:54.017: D/Retrofit(3595): at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
11-17 16:01:54.017: D/Retrofit(3595): at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
11-17 16:01:54.017: D/Retrofit(3595): at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
11-17 16:01:54.017: D/Retrofit(3595): at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
11-17 16:01:54.017: D/Retrofit(3595): at $Proxy0.getLoginCredentials(Native Method)
11-17 16:01:54.017: D/Retrofit(3595): at com.connected.merchant.SignIn$SignMeIn.doInBackground(SignIn.java:197)
11-17 16:01:54.017: D/Retrofit(3595): at com.connected.merchant.SignIn$SignMeIn.doInBackground(SignIn.java:1)
11-17 16:01:54.017: D/Retrofit(3595): at android.os.AsyncTask$2.call(AsyncTask.java:288)
11-17 16:01:54.017: D/Retrofit(3595): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-17 16:01:54.017: D/Retrofit(3595): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
11-17 16:01:54.017: D/Retrofit(3595): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-17 16:01:54.017: D/Retrofit(3595): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-17 16:01:54.017: D/Retrofit(3595): at java.lang.Thread.run(Thread.java:841)
11-17 16:01:54.017: D/Retrofit(3595): ---- END ERROR
Google 没有帮助我。如果你能帮我解决这个问题,那就太好了。谢谢。
【问题讨论】:
-
这个问题你解决了吗?
-
是的,我确实做到了,实际上,Jesse 帮助了我,如果您需要解决方法,请务必提及。这是 okHttp Jar 文件中的错误。
-
能否提供解决方法的详细信息?
-
@Shree 请检查this 我想知道你为什么要使用旧版本..
标签: android networking retrofit okhttp