官方资料
官方地址
github源码
使用范围
OkHttp支持Android 2.3及其以上版本。 对于Java, JDK1.7以上。
最新jar包下载地址
jar下载
gradle配置
compile 'com.squareup.okhttp3:okhttp:3.6.0'
以下是自己封装的使用流程:
1.在Application初始化 经过多次测试这种模式效率还算高

2.初始化单例模式创建

3.创建构造器

4.get的请求方式

5.post的请求方式以及自己封装了post的键值对



6.上传头像的两种方式(文件上传和二进制上传)


7.设置标题头token验证以及上传json的方法

8.封装errcode判断

9.httpException封装


作者:Luke(刘泽旻)
网友评论