Why HTTP/2 is not supported by Android's HttpUrlConnection?

笑着哭i 提交于 2019-12-12 17:31:24

问题


I just found out that Android's recommended http client HttpUrlConnection doesn't support HTTP/2.

Is there a specific reason not to use HTTP/2 on Android?


回答1:


You can use OkHttp if you want to take advantage of HTTP/2:

https://github.com/square/okhttp

It's superior to HttpUrlConnection anyway. If you're doing anything at all complicated, like getting complex JSON responses from a web API, I'd recommend Retrofit:

https://square.github.io/retrofit/



来源:https://stackoverflow.com/questions/52671739/why-http-2-is-not-supported-by-androids-httpurlconnection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!