gpt4 book ai didi

android - java.io.IOException : stream was reset: REFUSED_STREAM on several devices 异常

转载 作者:行者123 更新时间:2023-11-29 15:41:04 24 4
gpt4 key购买 nike

我在我的 Android 应用程序中使用 Retrofit 1.9。

服务器在带有 Nginx 的 Django 上,带有 HTTP 2 的 HTTPS。证书来自 WoSign,在 SSL Labs 上得分为“A”。

我正在 3 台设备上进行测试:

  • Nexus 4,Android 5.1.1(官方)
  • Nexus 9、Android 7.0(官方)
  • 三星 Galaxy S3,Android 4.4(官方)

在 SGS3 上它工作正常,但在 Nexus 4 和 9 上我遇到异常:

java.io.IOException: stream was reset: REFUSED_STREAM
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
at com.squareup.okhttp.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:150)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:87)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:722)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:576)
at com.squareup.okhttp.Call.getResponse(Call.java:287)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
at com.squareup.okhttp.Call.execute(Call.java:80)
at retrofit.client.OkClient.execute(OkClient.java:53)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at retrofit.Platform$Android$2$1.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:761)

最佳答案

如果有人仍然遇到问题(2018 年)。

我已经通过将改造版本更新为

解决了这个问题
 implementation 'com.squareup.retrofit2:retrofit:2.4.0'

关于android - java.io.IOException : stream was reset: REFUSED_STREAM on several devices 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40312946/

24 4 0