网络相关依赖库
//请求网络相关
//okhttp
//https://github.com/square/okhttp
implementation 'com.squareup.okhttp3:okhttp:4.2.0'
//用来打印okhttp请求日志
//当然也可以自定义
implementation("com.squareup.okhttp3:logging-interceptor:4.2.0")
//retrofit
//https://github.com/square/retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
//使用gson解析json
//https://github.com/google/gson
implementation 'com.google.code.gson:gson:2.8.5'
//适配retrofit使用gson解析
//版本要和retrofit一样
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
//适配retrofit支持rxjava
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
/**
* 注意:retrofit gson adapter-rxjava2 的版本号一样,防止出错
*/
//使用了Android响应式编程
//RxJava和RxAndroid区别?
//简单来说:就是RxAndroid在RxJava的基础上
//优化了一些功能
//增强了Android特有的功能
//https://github.com/ReactiveX/RxAndroid
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'