Articles

Reverse engineering Android apps with AI: jadx, apktool, smali and Frida

How to analyse and test an Android app you own or are authorized to test with an AI agent — decompiling with jadx, resources and smali with apktool, reading smali with the model, Frida hooks it writes for you, and where TLS pinning fits, with OWASP MASTG as the reference.

· 7 min read

An old-master oil painting of a walnut cracked open on a dark table, brass clockwork gears inside it, one gear glowing like an ember beside a small pick.

Android apps are one of the friendliest targets for AI-assisted reverse engineering. An APK decompiles to readable Java or Kotlin far more faithfully than a native binary decompiles to C, so a model is reading something close to the original source. It can map an app's activities and services, find where an API key is built, explain a custom crypto wrapper, and write the Frida hook to confirm it at runtime — in minutes.

This guide is about analysing and testing your own app, or one you're authorized to test: your company's app, an app that's in scope on a bug-bounty program, or a deliberately vulnerable training app. For practice, InsecureBankv2, DIVA and the OWASP MAS crackmes (UnCrackable) exist for exactly this. The reference for all of it is the OWASP Mobile Application Security Testing Guide (MASTG), which documents the methodology and tooling in far more depth than any article can.

The short version: decompile everything to files the agent can grep, have it map the app before reading code, and confirm every claim at runtime.

The Android analysis workflowStart with an APK you own or are authorized to test. Decompile it with jadx for Java source and with apktool for resources and smali. Have the agent map the app from the manifest, then read the code that matters. Confirm its claims at runtime with Frida on a test device or emulator.Your APK, or oneyou may testjadx:Java sourceapktool:resources, smaliAgent maps the appfrom the manifestRead the codethat mattersConfirm at runtimewith Frida
The Android analysis workflow

What AI is good at on Android

  • Mapping the app. Reading AndroidManifest.xml and listing components, exported activities and services, permissions, deep links and the network security config.
  • Reading decompiled code. Following a request from the UI to the HTTP client, finding where tokens are stored, explaining obfuscated-but-readable code once ProGuard or R8 names are in the way.
  • Reading smali where jadx gives up, which it does on some heavily optimized methods.
  • Writing Frida hooks for a specific method, with the logging you want.

Where it fails

  • Renamed code. R8 turns classes into a.b.c. The model will name them from context, and some of those names will be wrong. Make it say what evidence each name rests on.
  • Native code. Logic in a .so library is back to native reverse engineering — see the Ghidra/IDA guide.
  • Assuming the decompiler is right. jadx marks methods it couldn't decompile cleanly; the model may not notice. Those are exactly the ones to check in smali.

Step 1: get the APK and decompile it

For your own app, use the build artifact. For an app installed on your test device, pull it:

adb shell pm path com.example.app        # lists base.apk and any split APKs
adb pull /data/app/.../base.apk app.apk
sha256sum app.apk

Then decompile with jadx for Java source and apktool for resources and smali:

jadx -d out-jadx app.apk               # Java/Kotlin-ish source + resources
apktool d app.apk -o out-apktool       # decoded manifest, resources, smali

Now the agent has two trees it can search. jadx's output is what it should read first; apktool's is where the decoded manifest, res/xml/ configs and smali live.

Step 2: have the agent map the app

Start from the manifest, not the code. A good first prompt:

Read out-apktool/AndroidManifest.xml and res/xml/. In notes.md, list the package name, min/target SDK, permissions, every activity, service, receiver and provider with whether it's exported, any deep-link intent filters, and the network security config. Flag anything exported without a permission. Then find the HTTP client in out-jadx and list the base URLs.

Exported components without permission checks, overly broad deep links, a cleartext-traffic allowance and debuggable builds are the classic findings at this stage — all covered in MASTG's platform-interaction and network chapters. The agent will find them quickly; your job is to check each against the manifest itself.

Step 3: read the code that matters

With a map, point the agent at specific questions rather than "analyse the app":

grep -rn "SharedPreferences\|getSharedPreferences" out-jadx/sources | head
grep -rn "Cipher.getInstance\|SecretKeySpec\|MessageDigest" out-jadx/sources | head
grep -rn "https://" out-jadx/sources | sort -u | head -50

Then ask, for example: where is the session token stored after login, and is it encrypted? or what does this class do with the key it builds, and where does the key material come from? Hard-coded keys, insecure local storage and weak crypto usage are things the model spots reliably — the MASTG storage and cryptography chapters list what to look for.

Step 4: smali, when jadx gives up

When jadx shows a method as failed or produces something that clearly doesn't match, go to the smali in out-apktool/smali*/. Smali is verbose but regular, and models read it well:

Here is the smali for La/b/c;->d(Ljava/lang/String;)Ljava/lang/String; from out-apktool. Explain what it does step by step, citing the instructions, and write equivalent Java.

Check the result against the Java jadx did produce for neighbouring methods; if they disagree, trust the smali.

Step 5: confirm at runtime with Frida

Static reading gives you a hypothesis; Frida tests it. On an emulator or a test device running frida-server (MASTG covers the setup), frida-trace is the quickest start. Its -j option traces Java methods by class and method pattern:

frida-ps -Uai                                         # installed apps on the device
frida-trace -U -f com.example.app -j 'com.example.app.crypto.*!*'

For anything specific, have the agent write a short script. A hook that logs the arguments and return value of one of your app's methods looks like this:

// log.js — frida -U -f com.example.app -l log.js
Java.perform(() => {
  const Crypto = Java.use('com.example.app.crypto.TokenCipher');
  Crypto.encrypt.implementation = function (plain) {
    const out = this.encrypt(plain);
    console.log('encrypt(', plain, ') ->', out);
    return out;
  };
});

Ask for the hook together with what you expect it to print. If the output disagrees with the agent's reading of the code, that's the most useful moment in the whole analysis — one of them is wrong, and now you can find out which.

Static reading proposes, runtime confirmsThe agent reads the decompiled code and proposes what a method does. It writes a Frida hook and says what it expects to see. The hook runs on a test device. If the output matches, the finding is confirmed; if not, go back to the code or the smali.yesnoAgent reads code,proposes behaviourWrites a hook+ expected outputRuns on atest deviceOutputmatches?ConfirmedRe-readthe smali
Static reading proposes, runtime confirms

TLS pinning, when testing your own build

To inspect your app's API traffic through a proxy like mitmproxy or Burp, the app has to trust the proxy's certificate, and since Android 7 apps don't trust user-installed CAs by default; certificate pinning makes it stricter still. For your own app, the clean answer is in the build, not in a runtime bypass: Android's network security configuration has a debug-overrides section that applies only to debuggable builds:

<!-- res/xml/network_security_config.xml -->
<network-security-config>
  <debug-overrides>
    <trust-anchors>
      <certificates src="user" />
    </trust-anchors>
  </debug-overrides>
</network-security-config>

Release builds are unaffected, so the production app keeps its protections, while your debug build can be tested through a proxy. For an authorized test of a release build, MASTG's network-communication chapter documents the established dynamic approaches and the tools used for them; follow it rather than a snippet from a forum, since what works depends on how the app implements pinning. We don't reproduce those steps here. Once traffic is visible, the mitmproxy API guide covers mapping it.

Keeping it honest and in scope

Put these in your project instructions (CLAUDE.md, AGENTS.md or CAVEIRA.md):

  • Name the app and why you're authorized to test it: your own, a program's in-scope app, or a training app.
  • Never send traffic to a backend that isn't yours or explicitly in scope; a lab app with its own local server is the safe default.
  • Cite a file and line, or a smali method, for every claim.
  • Mark findings confirmed (seen at runtime) or inferred (from code).
  • Use a dedicated test device or emulator, never your personal phone.

Which AI to use

Any agent with a shell can run jadx, apktool, adb and Frida: Claude Code, Codex, OpenCode, caveira and others. What matters for Android work is a long context for large decompiled trees, a workflow that greps rather than pastes, and an assistant that handles ordinary app analysis without balking — mainstream assistants sometimes get cautious around runtime instrumentation even on your own app (what to do about that).

caveira is one option built for this kind of work: its backend serves uncensored, abliterated open-weight models, it ships a reverse-engineering skill, and it speaks MCP, so tools you already use can be added. It doesn't replace MASTG or knowing the tools; everything in this guide applies whichever agent you use. For the native side of an app, continue with the Ghidra/IDA/radare2 guide or firmware RE for the embedded equivalent.