Adding a feature to a closed-source app

· ai books · Source ↗

TLDR

  • Developer patched closed-source Android app Smart Audiobook Player using apktool, jadx, and compiled Java injected via smali to add Audiobookshelf progress syncing.

Key Takeaways

  • APKs can be partially decompiled to readable Java via jadx; smali (from apktool) is the editable, recompilable bytecode layer that enables patching.
  • A single convergence point, PlayerService.u0(), handled all progress-save paths, making it the ideal smali hook for injecting an invoke-static call to new Java code.
  • New Java (~550 lines) was compiled with javac and packaged as classes2.dex via d8 (standard Android SDK), then dropped into the apktool tree, no smali logic required for the feature itself.
  • Book-to-server matching used a JSON config file per book directory, avoiding fragile name-lookup and supporting multiple books without UI changes to the closed-source app.
  • LLM dual-review (Claude + GPT) caught reflection code, a resource compression bug, and a race condition; human review caught a critical progress-overwrite issue LLMs missed entirely.

Hacker News Comment Review

  • Discussion is sparse; main technical thread focuses on how the injected Java accesses host app classes at compile time, a real gap the author acknowledged without fully resolving.
  • Commenters noted ReVanced as an existing framework for non-root Android app patching, relevant for builders wanting a more structured starting point than raw apktool workflows.

Original | Discuss on HN