我正在使用改造将数据传递到服务器。但是在响应中出现以下异常:
okhttp3.internal.http2.StreamResetException:流已重置:REFUSED_STREAM
针对上述例外情况,我引用了以下链接: java.io.IOException: stream was reset: REFUSED_STREAM on several devices
并将更新版本和okhttp版本更新为以下版本:
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
仍然无法解决问题。如何解决?
答案 0 :(得分:3)
为时已晚,您可能已解决此问题,但就我而言,我解决了在OKHttpClient
中添加协议的问题:
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.protocols( Collections.singletonList(Protocol.HTTP_1_1) );
致谢!