android - 为什么 Android 的 HttpUrlConnection 不支持 HTTP/2?
问题描述
我刚刚发现Android推荐的http客户端HttpUrlConnection
不支持HTTP/2。
是否有特定原因不在 Android 上使用 HTTP/2?
解决方案
如果你想利用 HTTP/2,你可以使用 OkHttp:
https://github.com/square/okhttp
无论如何,它都优于 HttpUrlConnection。如果您正在做任何复杂的事情,例如从 Web API 获取复杂的 JSON 响应,我建议您使用 Retrofit:
推荐阅读
- c++ - 转换 std::vector
使用 std::views 在 C++20 中只是一个 std::string - python - 有没有办法在 Python 中获取 ASCII 字符?
- git - 如何使用 github api 列出目录下的所有文件名?
- typescript - 在 Gremlin + Neptune 中,Inject() 要作为顶点插入的字符串列表需要很长时间
- sql - 如何从 SQL 表中获取行,而忽略在某一特定列中具有重复值的行
- ethereum - Goerli 测试网挂起交易耗时太长?
- node.js - One-drive-api : body 必须是字符串
- python - python删除堆积面积图中的边缘
- gitlab - 在 gitlab 中触发命名管道
- node.js - 使用node Js安装appium失败