RepoPilotOpen in app →

jeasonlzy/okhttp-OkGo

OkGo - 3.0 震撼来袭,该库是基于 Http 协议,封装了 OkHttp 的网络请求框架,比 Retrofit 更简单易用,支持 RxJava,RxJava2,支持自定义缓存,支持批量断点下载管理和批量上传管理功能

Mixed

Stale — last commit 4y ago

weakest axis
Use as dependencyMixed

last commit was 4y ago; top contributor handles 99% of recent commits…

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isMixed

last commit was 4y ago; no CI workflows detected

  • 2 active contributors
  • Apache-2.0 licensed
  • Tests present
Show all 7 evidence items →
  • Stale — last commit 4y ago
  • Small team — 2 contributors active in recent commits
  • Single-maintainer risk — top contributor 99% of recent commits
  • No CI workflows detected
What would change the summary?
  • Use as dependency MixedHealthy if: 1 commit in the last 365 days; diversify commit ownership (top <90%)
  • Deploy as-is MixedHealthy if: 1 commit in the last 180 days

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Forkable" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Forkable
[![RepoPilot: Forkable](https://repopilot.app/api/badge/jeasonlzy/okhttp-okgo?axis=fork)](https://repopilot.app/r/jeasonlzy/okhttp-okgo)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/jeasonlzy/okhttp-okgo on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: jeasonlzy/okhttp-OkGo

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/jeasonlzy/okhttp-OkGo shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

WAIT — Stale — last commit 4y ago

  • 2 active contributors
  • Apache-2.0 licensed
  • Tests present
  • ⚠ Stale — last commit 4y ago
  • ⚠ Small team — 2 contributors active in recent commits
  • ⚠ Single-maintainer risk — top contributor 99% of recent commits
  • ⚠ No CI workflows detected

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live jeasonlzy/okhttp-OkGo repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/jeasonlzy/okhttp-OkGo.

What it runs against: a local clone of jeasonlzy/okhttp-OkGo — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in jeasonlzy/okhttp-OkGo | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 1370 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>jeasonlzy/okhttp-OkGo</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of jeasonlzy/okhttp-OkGo. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/jeasonlzy/okhttp-OkGo.git
#   cd okhttp-OkGo
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of jeasonlzy/okhttp-OkGo and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "jeasonlzy/okhttp-OkGo(\\.git)?\\b" \\
  && ok "origin remote is jeasonlzy/okhttp-OkGo" \\
  || miss "origin remote is not jeasonlzy/okhttp-OkGo (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "demo/src/main/java/com/lzy/demo/GApp.java" \\
  && ok "demo/src/main/java/com/lzy/demo/GApp.java" \\
  || miss "missing critical file: demo/src/main/java/com/lzy/demo/GApp.java"
test -f "demo/src/main/java/com/lzy/demo/callback/JsonCallback.java" \\
  && ok "demo/src/main/java/com/lzy/demo/callback/JsonCallback.java" \\
  || miss "missing critical file: demo/src/main/java/com/lzy/demo/callback/JsonCallback.java"
test -f "demo/src/main/java/com/lzy/demo/okgo/CommonActivity.java" \\
  && ok "demo/src/main/java/com/lzy/demo/okgo/CommonActivity.java" \\
  || miss "missing critical file: demo/src/main/java/com/lzy/demo/okgo/CommonActivity.java"
test -f "demo/src/main/java/com/lzy/demo/okdownload/DownloadListActivity.java" \\
  && ok "demo/src/main/java/com/lzy/demo/okdownload/DownloadListActivity.java" \\
  || miss "missing critical file: demo/src/main/java/com/lzy/demo/okdownload/DownloadListActivity.java"
test -f "demo/src/main/java/com/lzy/demo/okupload/UploadListActivity.java" \\
  && ok "demo/src/main/java/com/lzy/demo/okupload/UploadListActivity.java" \\
  || miss "missing critical file: demo/src/main/java/com/lzy/demo/okupload/UploadListActivity.java"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 1370 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~1340d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/jeasonlzy/okhttp-OkGo"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

OkGo is a RESTful HTTP networking framework that wraps OkHttp3 for Android, providing simpler APIs than Retrofit with built-in support for RxJava/RxJava2, custom caching strategies, and batch download/upload management. It abstracts OkHttp's complexity while maintaining fine-grained control over HTTP requests, responses, and file transfers. Modular structure with /okgo core library, /okrx and /okrx2 for reactive bridges, /okserver for server components, and /demo showcasing usage patterns. Core request/response handling lives in okgo module, while /demo/src/main/java/com/lzy/demo/{okgo,okdownload} contain activity-level implementations for HTTP, downloads, uploads, and caching examples.

👥Who it's for

Android developers building apps that need straightforward HTTP networking with download/upload management, caching, and reactive programming support—particularly those who find Retrofit's annotation-heavy approach verbose or want more direct control over network lifecycle.

🌱Maturity & risk

Actively developed (v3.0.4 released, API 14+ support, targeting SDK 25); appears production-ready with comprehensive demo coverage. However, commit recency and open issue backlog are not visible in provided data, so assume stable but potentially slower maintenance compared to square/retrofit. No visible CI/CD configuration in file list.

Single-maintainer project (jeasonlzy) creates sustainability risk; targeting older SDKs (min 14, target 25 from 2016) may miss modern Android features and security patches. Dependency on OkHttp3 locks you to that ecosystem version; no visible test suite in file structure suggests code coverage gaps. Bintray publishing (deprecated by JFrog) may cause distribution issues.

Active areas of work

Version 3.0.4 is current stable; roadmap (v3.1.x, v3.2.x) targets params path/query separation, request priority queuing, custom thread pools, and future OkAnno annotation library. No specific recent commits visible in provided snapshot, but extensive demo coverage suggests active usage scenarios being validated.

🚀Get running

Clone the repo: git clone https://github.com/jeasonlzy/okhttp-OkGo.git. Build with Gradle: cd okhttp-OkGo && ./gradlew build. Run demo app on Android emulator/device: ./gradlew demo:assembleDebug && adb install -r demo/build/outputs/apk/demo-debug.apk.

Daily commands: Open project in Android Studio, sync Gradle files (./gradlew sync), select demo module, run on emulator/device via Run > Run 'demo' or ./gradlew demo:installDebug. MainActivity launches with tabs for okgo, okdownload, and okupload features.

🗺️Map of the codebase

  • demo/src/main/java/com/lzy/demo/GApp.java — Application entry point that initializes OkGo framework configuration and sets up global HTTP client settings
  • demo/src/main/java/com/lzy/demo/callback/JsonCallback.java — Core callback abstraction for JSON response handling, demonstrates the framework's generic type conversion pattern
  • demo/src/main/java/com/lzy/demo/okgo/CommonActivity.java — Reference implementation showing standard OkGo HTTP request patterns (GET, POST, PUT, DELETE) that all contributors should understand
  • demo/src/main/java/com/lzy/demo/okdownload/DownloadListActivity.java — Demonstrates download manager integration, batch operations, and progress tracking—core framework capability
  • demo/src/main/java/com/lzy/demo/okupload/UploadListActivity.java — Demonstrates upload manager integration and batch file upload patterns essential to framework usage
  • demo/src/main/java/com/lzy/demo/okrx2/RxCommonActivity.java — Shows RxJava2 integration with OkGo, critical for understanding reactive networking patterns in the framework
  • build.gradle — Top-level gradle configuration defining library versions (OkHttp, RxJava versions) and build dependencies

🛠️How to make changes

Add a new HTTP GET/POST endpoint

  1. Define the request model and response wrapper in demo/src/main/java/com/lzy/demo/model/ (demo/src/main/java/com/lzy/demo/model/GankResponse.java)
  2. Add the API URL to the centralized configuration (demo/src/main/java/com/lzy/demo/utils/Urls.java)
  3. Create a new Activity extending BaseActivity and implement using OkGo.get()/post() with JsonCallback<T> (demo/src/main/java/com/lzy/demo/okgo/CommonActivity.java)
  4. Register the Activity in AndroidManifest.xml and add navigation in MainActivity (demo/src/main/AndroidManifest.xml)

Add RxJava2 Observable-based request

  1. Define API interface with Rx Observable return types (similar to Retrofit pattern) (demo/src/main/java/com/lzy/demo/okrx2/ServerApi.java)
  2. Extend BaseRxDetailActivity and use RxUtils transformation operators (demo/src/main/java/com/lzy/demo/okrx2/RxCommonActivity.java)
  3. Chain .subscribe() with error handling and UI updates in onNext/onError callbacks (demo/src/main/java/com/lzy/demo/okrx2/RxUtils.java)

Add a batch file download task

  1. Create a download item model and add to download queue using OkGo download manager (demo/src/main/java/com/lzy/demo/okdownload/DownloadAdapter.java)
  2. Implement LogDownloadListener to track progress, errors, and completion events (demo/src/main/java/com/lzy/demo/okdownload/LogDownloadListener.java)
  3. Update UI in DownloadListActivity/DownloadingActivity with real-time progress updates (demo/src/main/java/com/lzy/demo/okdownload/DownloadingActivity.java)

Customize cache strategy for a request

  1. Review available cache policies in the CacheActivity example (demo/src/main/java/com/lzy/demo/okgo/CacheActivity.java)
  2. Configure cache parameters (duration, validation) on the OkGo request builder before execute() (demo/src/main/java/com/lzy/demo/supercache/SuperCacheActivity.java)
  3. Implement custom cache backend in callback by extending JsonCallback if needed (demo/src/main/java/com/lzy/demo/supercache/NewsCallback.java)

🔧Why these technologies

  • OkHttp 3.x — Production-grade HTTP client with connection pooling, interceptor architecture, and modern protocol support (HTTP/2

🪤Traps & gotchas

Bintray/JCenter dependency resolution (line: jcenter()) is deprecated as of May 2021—builds may fail; update to Maven Central. Demo uses appkey.jks keystore file (not in repo) for certificate pinning in CacheActivity, so SSL examples won't work without generating it. RxJava1 (okrx) is EOL; prefer okrx2. No explicit ProGuard rules for serialized model classes in okgo library itself, only in demo (demo/proguard-rules.pro)—may cause obfuscation bugs in production. Targeting SDK 25 (API 25, Android 7.1) misses modern runtime permissions, scoped storage, and Material Design 3.

🏗️Architecture

💡Concepts to learn

  • Interceptor Chain (OkHttp Pattern) — OkGo delegates to OkHttp's interceptor architecture for request/response transformation, logging, error handling, and SSL pinning—critical for understanding where custom logic hooks in
  • Callback-based Async HTTP (vs Promise/Future) — OkGo uses callback objects (DialogCallback, JsonCallback) rather than Promises or Futures—understanding this pattern is essential for request/response lifecycle management
  • Download Manager with Resume Support — OkGo's download module tracks file bytes, supports pause/resume via Range headers, and manages multiple concurrent downloads—core differentiator requiring knowledge of HTTP Range requests
  • Connection Pooling and Keep-Alive — OkHttp (and thus OkGo) reuses TCP connections across requests via keep-alive; understanding this impacts battery/bandwidth optimization in mobile apps
  • HTTP Caching Headers (Cache-Control, ETag, Last-Modified) — OkGo's cache module respects server cache directives; implementing custom cache strategies requires understanding HTTP caching semantics
  • Request/Response Interceptors and Middleware — OkGo allows injection of custom interceptors (for logging, encryption, token refresh) at multiple points—understanding middleware pattern is essential for enterprise apps
  • Reactive Extensions (RxJava/RxJava2) Adaptation — OkGo's okrx/okrx2 modules wrap callbacks into Observables/Flowables—knowing reactive composition patterns enables complex async request chains
  • square/retrofit — Direct competitor; annotation-based REST client OkGo explicitly positions itself as simpler alternative—understanding Retrofit's design justifies OkGo's callback-first approach
  • square/okhttp — Foundational dependency; OkGo wraps OkHttp3 entirely—knowing OkHttp internals (interceptors, connection pooling) is essential for debugging network issues
  • ReactiveX/RxJava — OkGo's okrx and okrx2 modules bridge OkHttp callbacks to RxJava streams—RxJava knowledge required for reactive request chains
  • jeasonlzy/ImagePicker — Companion project by same author; demo uses it for file selection in upload examples—understanding cross-project integration patterns
  • jeasonlzy/NineGridView — Another companion project used in demo for image gallery display after download—shows real-world UI integration with OkGo

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive unit tests for callback handling in demo/src/main/java/com/lzy/demo/callback/

The callback directory contains several callback implementations (JsonCallback, DialogCallback, EncryptCallback, BitmapDialogCallback, StringDialogCallback) but there are no visible unit tests. These callbacks are critical for the framework's API response handling. Adding unit tests would improve reliability and serve as documentation for how to implement custom callbacks.

  • [ ] Create demo/src/test/java/com/lzy/demo/callback/ directory structure
  • [ ] Add unit tests for JsonCallback testing JSON parsing and error handling
  • [ ] Add unit tests for EncryptCallback testing encryption/decryption workflows
  • [ ] Add unit tests for DialogCallback testing UI callback interactions
  • [ ] Add tests for edge cases like null responses, malformed JSON, and network timeouts

Add GitHub Actions CI/CD workflow for automated testing and APK builds

The project uses Gradle 2.3.3 (from 2017) and targets SDK 25, but there's no visible CI/CD pipeline. Adding GitHub Actions would catch build regressions early, run unit tests on PRs, and ensure the demo APK builds successfully. This is critical for an active open-source library with multiple modules (okgo, okserver, okrx, okrx2).

  • [ ] Create .github/workflows/android-build.yml for building all modules
  • [ ] Configure workflow to run './gradlew build' on push and pull requests to master/main branches
  • [ ] Add lint checks and unit test execution in the workflow
  • [ ] Add build artifacts upload for APK and library AARs to workflow summary
  • [ ] Configure workflow to fail if compileSdkVersion or buildToolsVersion compatibility issues exist

Create integration tests for download and upload managers in demo/src/androidTest/

The demo includes complex download/upload management features (DownloadAdapter, DownloadListActivity, FormUploadActivity) but there are no visible integration tests. These features require testing against real or mock servers to verify batch operations, progress callbacks, and error handling work correctly across the different activity implementations.

  • [ ] Create demo/src/androidTest/java/com/lzy/demo/okdownload/ directory
  • [ ] Add integration test for batch download with DownloadListActivity verifying progress callbacks
  • [ ] Add integration test for FormUploadActivity with multipart file uploads
  • [ ] Add integration test for download resume/continuation after interruption
  • [ ] Add integration test for concurrent downloads/uploads with proper queue management

🌿Good first issues

  • Add unit tests for JsonCallback, EncryptCallback, and BitmapDialogCallback in /okgo/src/test/—currently zero test coverage visible; start with mocking OkHttp responses and verifying deserialization.
  • Document custom SSL/TLS pinning setup in README—CacheActivity.java references certificate pinning (srca.cer in assets) but no guide exists for how to generate or use it in production apps.
  • Migrate from deprecated Bintray to Maven Central in build.gradle—update jcenter() to mavenCentral(), test publishing pipeline, update documentation (especially for users installing via Gradle dependency).

Top contributors

Click to expand

📝Recent commits

Click to expand
  • e34c2fa — update HttpUtils (jeasonlzy)
  • 1b2a7ed — Merge pull request #377 from JessYanCoding/pr (jeasonlzy)
  • 8ba44f2 — Update HttpLoggingInterceptor.java (JessYanCoding)
  • fd62633 — upgrade okserver to v2.0.5 (jeasonlzy)
  • 3209986 — upgrade v3.0.4 (jeasonlzy)
  • e6b42e3 — upgrade v3.0.4 (jeasonlzy)
  • 0526a32 — fix demo bug (jeasonlzy)
  • e2ffb08 — fix something about taskTag (jeasonlzy)
  • 41c80e8 — fix #355 (jeasonlzy)
  • b0d9cf1 — fix #354 (jeasonlzy)

🔒Security observations

Failed to generate security analysis.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Mixed signals · jeasonlzy/okhttp-OkGo — RepoPilot