昨天在作Android接口调用的时候,api接口是https的,用okhttp抛出:api
okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERRORui
缘由是协议错误致使的,解决办法很简单,在实例化okhttpclient的时候用如下方法:spa
OkHttpClient client = new OkHttpClient.Builder() .protocols(Collections.singletonList(Protocol.HTTP_1_1)) .build();
完美解决。code