Workflows

Android app reverse engineering with AI: APK to working code

Pull an APK from your own phone, decompile it with JADX and Apktool, hand the tree to an AI agent, and check its answers on a real device.

By Updated 10 min readJADXClaude Code

People have used an AI agent on decompiled Android apps to connect home batteries to Home Assistant, recover an undocumented phone API for about five cents, and work out what pre-installed software on a cheap projector was doing. This guide covers the workflow for apps on devices you own, for interoperability, your own development or defensive analysis.

Key facts
  • The Kyocera softkey API reconstruction used 47,573 tokens, about $0.05, with OpenCode and Gemini 3 Flash.
  • The Bluetti EP760 cloud gateway took an evening and its Bluetooth part a weekend, with Claude Code.
  • JADX needs 64-bit Java 11 or later unless you use its with-jre bundle, and Apktool needs at least Java 8.
  • JADX shows only code compiled to DEX, so native libraries, Flutter apps and React Native bundles need other tools such as Ghidra.

What do I need before I start?

  • An Android device you own, with Developer options and USB debugging turned on. Android hides Developer options by default; the developer options page explains how to show them.
  • adb from Android's platform-tools.
  • Java: JADX needs 64-bit Java 11 or later unless you use its with-jre bundle. Apktool needs at least Java 8.
  • An agent that can read files and run shell commands: Claude Code, or OpenCode with a model of your choice as in the Kyocera project.
  • Cost: the Kyocera reconstruction used 47,573 tokens, about $0.05. Larger apps cost more. Michael Still says he would not pay to analyse very large, heavily obfuscated apps himself.

Out of scope: bypassing licence checks, root or tamper detection, DRM, or anything that lets an app run in a way its maker blocks. The projects below only read code to understand how an app talks to hardware or to the OS.

What it took in the projects

ProjectGoalAgent and modelTime and cost reported
Kyocera softkey APIRebuild one hidden system APIOpenCode with Gemini 3 FlashSeconds per run; 47,573 tokens, about $0.05
Bluetti EP760Talk to a home battery without the vendor appClaude CodeCloud gateway in an evening, Bluetooth over a weekend
Emaldo home batteryRead a battery's local protocolClaude CodeOne day, per the write-up's title
Android projectorFind out what pre-installed apps were doingClaude CodeNot stated

One narrow question about one app finishes in hours, not weeks. A whole-app rewrite is a different project.

When this approach is not enough

JADX only shows code that was compiled to DEX. Look inside the APK before you start, because some apps keep their logic elsewhere:

  • Native libraries. Code under lib/<abi>/*.so is machine code called through JNI. JADX shows only the Java side of the call. Open the .so in Ghidra, ideally through an MCP server so the agent can read it (setup guide).
  • Flutter apps. Flutter compiles the app's Dart code ahead of time into native machine code (Flutter FAQ), which ships as a native library under lib/. JADX will show little beyond the Flutter engine's Java wrapper.
  • React Native apps. The logic is a JavaScript bundle in assets/, often index.android.bundle. With Hermes it is precompiled bytecode rather than readable JavaScript (Hermes docs).
  • Certificate pinning. If you also want to watch the app's traffic, an app that pins its server certificate will refuse your proxy (network security configuration). Reading the decompiled code still works. Getting around the pin is out of scope here.

For a protocol over Bluetooth rather than the internet, the capture route in the Bluetooth guide usually beats reading the app.

Step 1: Get the APK from your own device

The most reliable source is the phone where the app is already installed. These are the documented adb and package manager commands:

bash
adb devices                                   # confirm the phone is connected
adb shell pm list packages vendor             # filter package names containing "vendor"
adb shell pm list packages -3                 # or list third-party apps only
adb shell pm path com.vendor.app              # print the APK path(s)
adb pull /data/app/.../base.apk ./apks/       # copy each path printed above

Modern apps are often split into a base.apk plus split APKs, so pm path may print several lines. Tom Barrasso's Kyocera script ran pm path for each package and pulled every base and split APK. Barrasso picked candidates from about 200 packages on a Kyocera flip phone, partly by intuition and partly by asking an LLM.

For system apps that came with the device, the same commands work. Zane St. John listed the projector's packages and flagged the ones whose namespace did not match the vendor.

Michael Still got the Bluetti app from a Play Store mirroring site because Claude could not download it from the Play Store. If you have the device and the app, pulling it yourself avoids trusting a third party's copy.

Step 2: Decompile with JADX and Apktool

Use both tools. They give the agent different views.

  • JADX turns DEX bytecode into readable Java. Install it from its GitHub releases, with brew install jadx on macOS, sudo pacman -S jadx on Arch, or flatpak install flathub com.github.skylot.jadx.
  • Apktool decodes resources, the manifest and Smali. The current release is 3.0.3. Install it with the wrapper script and jar from the install page, or brew install apktool.
bash
jadx -d out/jadx --show-bad-code apks/base.apk
apktool d -f apks/base.apk -o out/apktool

--show-bad-code keeps methods JADX could not decompile cleanly instead of dropping them. The JADX README also lists --deobf to rename very short obfuscated names and -e to export a Gradle project. JADX's usage line accepts several input files, plus .apks, .xapk and .apkm bundles. With Apktool, -o sets the output folder and -f overwrites an existing one (CLI parameters).

Smali is worth keeping even when the Java looks fine. Barrasso's whole reconstruction worked from Apktool's Smali output.

Step 3: Set up the agent's workspace

Put the outputs in one folder and start the agent there:

text
myapp-re/
  apks/            # the files you pulled
  out/jadx/        # Java sources and resources
  out/apktool/     # Smali, AndroidManifest.xml, res/
  captures/        # traffic logs, if you have them
  NOTES.md         # findings, each marked confirmed or inferred

Put a few standing rules in the project instructions (CLAUDE.md for Claude Code): treat out/ as read-only, cite a file and line for every claim, mark anything not seen in code or traffic as inferred, and write findings to NOTES.md. St. John's projector brief had the same parts: the decompiled source, the available tools, a written mission with deliverables, an instruction to think carefully before major steps, a todo list, and hints about where to start.

Do your own first pass if you can. The Emaldo author had already decompiled the app, grepped for BLE UUIDs and noted the API endpoints before opening Claude Code.

Step 4: Ask for specific things

Broad questions get broad answers. These worked in the projects:

  • Reconstruct an API. Barrasso grepped the Smali, found a help screen that called the hidden KCfpSoftkeyGuide class, and asked Gemini 3 Flash in OpenCode to "Reassemble" that Smali file into its original Java class, concentrating on the Kyocera APIs it calls. The run took seconds.
  • Implement a protocol from the client code. Claude Code read the decompiled Bluetti app and built a cloud-to-MQTT gateway in an evening, then a BLE implementation over a weekend.
  • Map what an app does. On the projector, Claude wrote its own helper scripts to decode obfuscated strings, mapped the components and traced how they talked to each other.
  • Explain obfuscated code. On Emaldo, Claude traced classes with names like n0.a and n0.b to find which key each message type used.

Ask the agent to write a small client or test, not just an explanation. Running code is what you can check.

How do I check it works?

Test on the real device, and keep a log of what passed:

  • Barrasso added the reconstructed softkey API to the podcast app PodLP and ran it on a Kyocera DuraXV Extreme. A softkey bar that previously stayed on screen after the volume dialog stopped doing so.
  • Still's Bluetti gateway had been running for a couple of weeks at the time of the write-up.
  • Use adb logcat while you test to see your app's errors and the system's reaction.

For a protocol, compare your client's output against the vendor app on the same device. The Bluetooth guide covers capturing that traffic.

Defensive analysis of suspicious apps

The projector project is a defensive investigation. St. John noticed DNS queries from a new projector on a Pi-hole before opening any app, then pulled the pre-installed APKs, decompiled them with JADX and gave Claude Code the source. Claude found that the software enrols the owner's network in a residential proxy service. The recommendations: disable the packages, block the domains at the router or DNS, isolate such devices on their own network segment with outbound traffic blocked, and remember that a factory reset may reinstall the software.

If you do this, analyse decompiled code in an isolated VM, keep the device off your main network, and do not run or share the sample. Static reading is enough to understand behaviour.

Where does the AI go wrong?

  • Stubs that look like code. Gemini's KCfpSoftkeyGuide methods were empty placeholders, because the framework implementation was not in the APK it read. Resource labels were guessed, and the listener method was missing until Barrasso searched further. The API had also already been documented by others, so check for prior work (kyocera-softkey-api-gemini-opencode).
  • Wrong assumptions about the other side. The projector agent's first client assumed responses looked like requests. It fixed this by re-reading the code (android-projector-malware).
  • Giving up on crypto too early. Claude only got past Bluetti's authentication after being told to read the decompiled Java harder. It also confused two protocol paths that the app contains for different hardware (bluetti-ep760-home-assistant).
  • Trusting the source over the wire. On Emaldo, hours of reading obfuscated code led to the wrong framing. A capture from the real app in an emulator showed the actual format, with method codes byte-swapped relative to the Java. JADX could not display some method names at all (emaldo-home-battery).

Which projects used this?

Further reading

By

I started this site on 13 October 2026 to keep track of reverse engineering projects where an AI model did real work. I work on it alone, with no investors and no ad networks.

About the site · @whyamas on X

Changes

  • Added source-backed decision answers.

Sources

In practice

Directory projects behind this guide

Bluetti EP760: A home battery's cloud and Bluetooth protocols, into Home Assistant in an evening.
Works
Blog · APIs and protocols

Bluetti inverter cloud API and BLE protocol, bridged to Home Assistant

A home battery's cloud and Bluetooth protocols, into Home Assistant in an evening.

Platform Android / BLETime One evening for the cloud gateway, a weekend for BLE
Kyocera DuraXV Extreme softkey framework: A hidden flip-phone API recovered for about five cents.
Works
Blog · Apps

Recovered a hidden Kyocera flip-phone softkey API with Gemini 3 Flash in OpenCode

A hidden flip-phone API recovered for about five cents.

Platform AndroidCost About $0.05 (47,573 tokens)
Android projector (HY300 type): A $35 projector that enrols its owner's network in a residential proxy service.
Research
Blog · Malware (defensive)

Analysed the malware pre-installed on a $35 Android projector

A $35 projector that enrols its owner's network in a residential proxy service.

Platform AndroidTime A weekend
Emaldo Power Core 2.0: A home battery's Bluetooth and cloud protocols, documented in one day.
Works
Blog / GitHub · APIs and protocols

Reverse engineered Emaldo home battery protocols for Home Assistant integration

A home battery's Bluetooth and cloud protocols, documented in one day.

Platform AndroidTime About 8 hours, in one day

Picked

Amaran 150 lights: $91.34 and 3.5 hours of /goal later, the lights work without the app.
Works
Blog / X · APIs and protocols

Controlled Amaran studio lights over Bluetooth mesh without the vendor app

$91.34 and 3.5 hours of /goal later, the lights work without the app.

Platform Bluetooth meshTime About 3.5 hoursCost $91.34