
我在我的应用程序中使用Retrofit进行网络调用.该应用程序真的很好,速度很快.感谢精彩的图书馆.但是,它只适用于Wi-Fi.如果我在3G网络中运行应用程序,则抛出错误.流被重置:PROTOCol_ERROR,同时在3G网络中使用Retrofit
我已将此jar文件导入构建路径:
这是完整的堆栈跟踪:
11-17 16:01:54.017: D/Retrofit(3595): java.io.IOException: stream was reset: PROTOCol_ERROR11-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.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.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
谷歌没有帮助我.如果你帮我解决这个问题真的很棒.谢谢.
解决方法 看起来像OkHtttp或您的网络服务器的SPDY或http / 2实现中的错误.升级到Okhttp / 2.1.如果这不能解决问题,请在Okhttp的问题跟踪器&包括导致你悲痛的服务器的主机名. 总结以上是内存溢出为你收集整理的android – stream重置:PROTOCOL_ERROR,同时在3G网络中使用Retrofit全部内容,希望文章能够帮你解决android – stream重置:PROTOCOL_ERROR,同时在3G网络中使用Retrofit所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)