首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    android之Retrofit使用

    image.png Retrofit是什么 Github地址 Retrofit基于okhttp封装的网络请求框架, 网络请求的工作本质上是 OkHttp 完成,而 retrofit 仅负责网络请求接口的封装...Retrofit优势,就是简洁易用,解耦,扩展性强,可搭配多种Json解析框架(例如Gson),另外还支持RxJava. implementation 'com.squareup.retrofit2:retrofit...:2.6.2' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' gson是用来解析的Json数据使用的(个人偏爱Gson),retrofit...也支持其他解析工具比如fastJson 实战使用 创建Retrofit请求基础配置 Retrofit.Builder()就是希望你根据不同的业务创建出不同的Retrofit来搭配接口服务使用。...注意 base的网络地址 baseUrl不能为空,且强制要求必需以 / 斜杠结尾 private Retrofit mRetrofit;   private void initHttpBase(){

    83520
    领券