android–ProtocolException:预期’:status’标头不存在

android–ProtocolException:预期’:status’标头不存在,第1张

概述在工作应用程序中突然发生网络调用失败并出现协议异常.该应用程序一直工作到昨天,今天所有的网络呼叫都失败了.这些调用适用于HTTP,但使用HTTPS失败.这是日志,java.net.ProtocolException:Expected':status'headernotpresent10-1814:59:01.10330746-30746/?W/System.e

在工作应用程序中突然发生网络调用失败并出现协议异常.
该应用程序一直工作到昨天,今天所有的网络呼叫都失败了.这些调用适用于http,但使用httpS失败.

这是日志,

java.net.ProtocolException: Expected ':status' header not present10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.http2xStream.readhttp2headersList(http2xStream.java:262)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.http2xStream.readResponseheaders(http2xStream.java:145)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:67)10-18 14:59:01.103 30746-30746/? W/System.err:     at codmob.com.campuswallet.app.apiclient.intercept(apiclient.java:66)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:67)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:67)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.BrIDgeInterceptor.intercept(BrIDgeInterceptor.java:93)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)10-18 14:59:01.103 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:92)10-18 14:59:01.104 30746-30746/? W/System.err:     at okhttp3.internal.http.RealinterceptorChain.proceed(RealinterceptorChain.java:67)10-18 14:59:01.104 30746-30746/? W/System.err:     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)10-18 14:59:01.104 30746-30746/? W/System.err:     at okhttp3.RealCall.access0(RealCall.java:33)10-18 14:59:01.104 30746-30746/? W/System.err:     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)10-18 14:59:01.104 30746-30746/? W/System.err:     at okhttp3.internal.namedRunnable.run(namedRunnable.java:32)10-18 14:59:01.104 30746-30746/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)10-18 14:59:01.104 30746-30746/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)10-18 14:59:01.104 30746-30746/? W/System.err:     at java.lang.Thread.run(Thread.java:761)

解决方法:

经过几个小时的混乱,终于得到了解决方案.将Retrofit和Okhttp3库更新到最新版本对我来说是个窍门.

compile 'com.squareup.okhttp3:okhttp:3.9.0'compile 'com.squareup.retrofit2:retrofit:2.3.0'
总结

以上是内存溢出为你收集整理的android – ProtocolException:预期’:status’标头不存在全部内容,希望文章能够帮你解决android – ProtocolException:预期’:status’标头不存在所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1102077.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存