okhttp-OkGo
OkGo - 3.0 震撼来袭,该库是基于 Http 协议,封装了 OkHttp 的网络请求框架,比 Retrofit 更简单易用,支持 RxJava,RxJava2,支持自定义缓存,支持批量断点下载管理和批量上传管理功能
An Android networking library that simplifies HTTP requests by wrapping OkHttp, adding built-in response caching, RxJava support, and a companion module for batch file downloads and uploads.
OkGo is a networking library for Android apps, written in Java. Its job is to make it easier for Android developers to send HTTP requests, which are the calls an app makes to a server when it needs to load data, submit a form, upload a photo, or download a file. The library wraps a lower-level tool called OkHttp, removing a lot of the repetitive setup code that OkHttp normally requires.
The library supports two popular approaches for handling asynchronous work in Android called RxJava and RxJava2. It also includes a customizable caching system, so apps can store server responses locally and avoid repeating identical network calls. Beyond basic requests, OkGo includes a companion module called OkServer that adds batch download management and batch upload management, letting apps queue multiple files and track progress on all of them at once.
To add OkGo to a project, a developer adds one dependency line to their build file. Optional companion modules for RxJava support or the download/upload manager can be added separately depending on what the app needs. The README is written primarily in Chinese and includes animated demo screenshots showing features like file downloading and uploading in action.
The project follows the Apache 2.0 license. Documentation is maintained as a GitHub Wiki that stays in sync with the latest release. The author notes that the older 2.x version of the library is no longer maintained, and all bug fixes go into the current 3.x line. Support is available through a QQ group forum where users can ask questions.
OkGo targets Android API level 14 and higher, which covers nearly all Android devices still in active use. The project has been archived and is no longer under active development, but the code remains available and the existing feature set is stable.
Where it fits
- Add reliable HTTP networking to an Android app with minimal boilerplate by dropping in OkGo as a single Gradle dependency.
- Implement a download manager in an Android app that queues multiple files and tracks progress on each one using the OkServer module.
- Cache server responses locally in an Android app to reduce repeated network calls and support offline use.
- Integrate RxJava streams into Android networking code using OkGo's dedicated RxJava2 companion module.