Instrumenting Android 15 and 16 Apps: One Agent, API 28 to 36
Dynamic analysis on a brand-new Android release is where most tooling quietly falls over. The runtime internals shift, the symbols move, and the agent that worked on Android 13 either refuses to attach or attaches and reports nothing. This is the engineering story of how our in-house agent reaches every Android version from 9 to 16, API 28 through 36, on one unified mechanism, including the parts that broke on Android 15 and 16 and exactly how we fixed them. Everything below is device-measured on stock x86_64 emulators (plus a real arm64 phone), not asserted.
Why a new Android version breaks instrumentation
To observe or modify a running Android app you need a JVMTI environment, the debugging interface baked into the Android Runtime (ART). Getting one on a production device that was never launched in debug mode means doing three things ART normally reserves for the system: flip the app into a Java-debuggable state, load the JVMTI plugin, and attach an agent. ART does not expose a stable, versioned API for any of this. It exposes internal C++ symbols, mangled names like _ZN3art7Runtime11AttachAgentE..., whose presence, visibility, and calling convention change release to release. An agent that hardcodes those is one Android version away from breaking, and the break is rarely a clean error. More often the symbol is simply absent, or present but no longer exported, and the agent fails in a way that looks like the app did nothing interesting.
So the first job is a version gate: at arm time, resolve the exact set of internal ART symbols present on this device, by name, against the live libart.so that is already mapped into the target process, and pick the load route those symbols support. There is no reading of a hardcoded API-to-offset table, which rots the moment a vendor ships a custom build. The gate asks the binary in front of it what it actually exports. We measured that symbol set across stock images at API 28, 30, 31, 32, 33, 34, and 36, and the picture is not uniform. Three of the calls we need move around; two change meaning.
The span, at a glance
Here is the whole ladder, by API level, load route, debuggable-flip band, and current status. Everything in the status column is device-measured, not inferred.
| API | Android | Load route | Flip band | Status (field-write + host events) |
|---|---|---|---|---|
| 28 | 9 Pie | AttachAgent | LEGACY | lands, reports |
| 29 | 10 | AttachAgent | LEGACY | lands, reports |
| 30 | 11 | EnsurePluginLoaded | LEGACY | lands, reports (also arm64) |
| 31 | 12 | EnsurePluginLoaded | LEGACY | lands, reports |
| 32 | 12L | EnsurePluginLoaded | LEGACY | lands, reports |
| 33 | 13 | EnsurePluginLoaded | LEGACY | lands, reports |
| 34 | 14 | EnsurePluginLoaded | MODERN | lands, reports (67 events) |
| 35 | 15 | AttachAgent | MODERN | lands, reports (70 events, after the fix below) |
| 36 | 16 | AttachAgent | MODERN | lands, reports (60 events, after the fix below) |
Three things in that table are the whole story: the load route is not constant, the flip band flips at 34, and 35 and 36 needed a fix before the right-hand column was true. The rest of this post is those three things.
Two routes, because EnsurePluginLoaded is not everywhere
The clean way to load the JVMTI plugin is ART's own EnsurePluginLoaded, the same call frida-java-bridge leans on. The problem: it is only present and exported on API 30 through 34. On API 28 and 29 it never existed (older ART used Plugin::Load), and on API 35 and 36 it falls off a hidden-visibility cliff, the symbol is still in the binary but no longer exported where a hash-based resolver can see it. So the honest by-name ladder for that specific call is API 30 to 34, and the ends of the range, 28, 29, 35, and 36, need something else.
That something else is Runtime::AttachAgent, the one agent-load entry point exported across the entire span. Driving it on a non-debug app takes a precondition most tooling misses. AttachAgent's internal EnsureJvmtiPlugin refuses to load the plugin unless Dbg::IsJdwpAllowed() is true, and on a normally-launched app it is not: that flag is set by the zygote from fork debug flags, not by an agent attaching after the fact. So the AttachAgent route first calls Dbg::SetJdwpAllowed(true), then attaches.
There is a second, grubbier obstacle. AttachAgent takes its agent path as a const std::string&. You cannot hand that a Rust string or a C string: it wants a real libstdc++ std::string with the exact layout the device's libc++ uses. So the route goes through a tiny C++ trampoline that constructs the std::string, calls AttachAgent, and destructs it, and that trampoline links libc++ statically, so it adds no dynamic dependency the target process would have to satisfy. (It does not, and the moment it did, API 36 crashed with an UnsatisfiedLinkError for libc++_shared.so until we static-linked it. That is the kind of detail that only shows up on device.) The net result is one agent that picks EnsurePluginLoaded on 30-34 and AttachAgent on 28/29/35/36, selected per device at runtime, with no per-API rebuild.
The debuggable flip changed at API 34, and it is not where you would guess
Flipping an app Java-debuggable is its own banded problem. On API 33 and below it is one call, SetJavaDebuggable. On API 34 and above that call is not enough, and the reason is specific. The openjdk JVMTI layer gates full availability on IsFullJvmtiAvailable(), which checks IsJavaDebuggableAtInit(), not just the plain debuggable flag. So on 34+ you have to call SetRuntimeDebugState with the kJavaDebuggableAtInit state, whose enum value is 2, and not the plain kJavaDebuggable value of 1. Call the wrong one and the agent attaches, the plugin loads, and then GetEnv hands back a JvmtiEnvUnavailable error, because "debuggable" and "debuggable at init" are different booleans and only one of them unlocks the full environment.
The surprise is the boundary. The state names suggest the break is at 33, but it is measured at API 34. We band the flip LEGACY below 34 and MODERN at 34 and up, and it lands on every level in between. Getting that one enum value and that one band boundary right is the difference between "attaches but is useless" and "fully usable JVMTI env", and there is no documentation that tells you; you find it by watching GetEnv fail on a device and reading the ART source for why.
The resolver that had never run on a real device
Resolving those internal symbols sounds easy: call dlsym. It is not, because the symbols we need are not reliably in the dynamic symbol table the way dlsym expects, and on the hidden-visibility levels they are not exported at all. So the gate has a fallback: walk the mapped libart.so in memory, parse its ELF structures directly, and find the symbol by scanning the symbol table ourselves. For API 30 through 36 the normal dlsym path happened to work, so that in-memory walk had never actually executed on a real device. It was correct in tests and latent in production.
Then the pre-APEX 28 and 29 AttachAgent path forced the in-memory walk to run for real, and it exposed three latent bugs in a row, each only visible on hardware. First, the GNU-hash lookup missed symbols that were present, so we added a bounded linear scan of .dynsym as a fallback when the hash lookup comes up empty. Second, resolve() itself only fell through to the in-memory walk when dlopen returned null, not when dlsym returned null on an open handle, so a hash-blind miss on a present-but-protected symbol never reached the fallback at all; we made a dlsym miss fall through too. Third, and this one is the quiet killer: when we parsed the ELF program headers to find the symbol table, we read them at the module's load bias instead of its mapping base range_start. Those are the same number only when a library's first PT_LOAD has virtual address 0. API-28 libart.so's first PT_LOAD is at 0x27000, so bias and range_start differ by exactly that, and reading the ELF header at the wrong one of them gives you garbage program headers and no symbols. Reading at range_start fixed it.
None of those three was a regression. They were latent from the day the code was written, waiting for the one code path, an in-memory resolve on a library whose first segment is not at vaddr 0, that no device had exercised until API 28 made it mandatory. The lesson we keep relearning is that "passes its tests" and "has run on the metal" are different claims, and only the second one counts.
Proving it: the asymmetric field-write test
"It attached" proves very little. We prove the full stack, gate, flip, plugin load, hook install, and firing, with an asymmetric probe. The target app reads a boolean field and logs it; the field is false by itself. Only the agent's JVMTI SetBooleanField can make the app read it back as true. So a single fieldWriteProbe=true in the log is unforgeable proof that the agent reached inside the running app and changed its state. The asymmetry matters: a test where the expected value is also the default value proves nothing, because you cannot tell the hook from the app. Here the app can never print true on its own.
Run it across the matrix and it lands on all nine levels, API 28 through 36, 25 firings each on a 20-second window, with zero false positives (mutation off yields zero true readings, we check the negative every time). We also ran the same test on real arm64 hardware, a stock, unrooted Moto e40 on Android 11, delivered by repackaging the benign test fixture with the agent and resigning it, no root. The field write lands there too: 39 firings with mutation on, zero with it off, a clean A/B on real silicon. The JVMTI mutation tier is architecture-independent; the same version gate and the same SetBooleanField that work on an x86_64 emulator work on a physical phone. (Inline-hook code generation, which does care about the instruction set, is a separate concern we scope separately and do not fold into this claim.)
Where Android 15 and 16 broke, and the fix
Here is the part most "we support the latest Android" claims skip. When we re-ran the full matrix on a fresh build, the field write landed on API 35 and 36, the hook installed and fired, 25 fieldWriteProbe=true in the log, but the host received zero events and the session came back with the eager-install confirmation unreported. The app was being instrumented. We just could not see any of it from the host. On Android 15 and 16 only; 28 through 34 reported 67 to 101 events each, cleanly. That is the worst possible failure mode, because "it attaches and fires but you see nothing" is indistinguishable, to a careless operator, from "the app is boring."
It would have been easy to hand-wave this as a new-Android quirk. We traced it instead. It was not SELinux (zero avc denials for the app's domain), and not the eager-install race we first suspected, agent-side logging showed spec_found=true, eager install ran and parsed its spec fine. So we instrumented the control-plane thread with ordered log markers and read the trace on a real API-35 emulator. It went: connect ok, install_report_sent (so the host sees the hook site, which is why the session showed one site), then the startup probes began, after_timing, after_barrier_expiry, after_b0, and then silence. The event_loop_enter marker never printed. The thread reached a probe and hung before the event-forwarding loop, and that loop is the only thing that drains queued events to the host. So the install confirmation and every hook hit piled up in the queue and never left the device.
Bisecting the probes between the last marker and the dead one narrowed the hang to exactly one call: a cipher-usability self-check that performs a real javax.crypto.Cipher operation while it has swapped in its own JVMTI callback table. That provoke, a Java crypto call from the control-plane thread under a replaced callback table, deadlocks on Android 15 and 16. It did not on 28 through 34. It is a non-essential diagnostic: the real hook already fired and proved breakpoints work, so the cipher self-check adds nothing on a run where the actual hook landed. The fix is a one-guard change, about fifteen lines: skip that provoke on API 35+ where it deadlocks, and let the event loop run. After the fix, API 35 reports 70 events and API 36 reports 60, both with eager install confirmed, and API 34 is unchanged at 67, no regression. The full span now observes and reports.
We are telling you this at length because the failure mode is the dangerous one. A tool that cannot attach at all tells you so. A tool that attaches, fires, and silently drops every event tells you nothing is wrong while it hands you an empty transcript, and you ship a report that says the app is clean when you never actually watched it. The fix was fifteen lines. The value was finding it at all, and the only way we found it was by refusing to accept "zero events" as an answer.
Seeing the span in the GUI
Rutken's Dynamic view shows the supported span directly, Android 9 through 16 (API 28-36), with the load route it will use for the selected device (EnsurePluginLoaded or AttachAgent) called out per level. When you attach to an app, each observed network destination is badged by how it was captured, so you always know whether a result came from the agent or from a deeper runtime path, and you are never guessing which mechanism produced a finding. The version gate runs on the device you selected; if a particular build ships a stripped or customized libart.so, the gate resolves against that binary rather than a stored assumption, which is the whole reason it reads symbols at arm time instead of trusting a table.
What this does and does not claim
Stated plainly, because that is how we grade ourselves. What is device-proven across API 28-36, including the two newest releases: the version gate, the banded debuggable flip, the plugin load on both routes, hook install, and the JVMTI mutation tier (the field write). That is a real, measured span, not a marketing one.
What this is not: it is not a claim about defeating hardware-backed attestation. A cooperative-runtime agent is a software observer, and an app that gates its behavior on Play Integrity's hardware path is a different problem that no software observer, however clever, forges its way past. And the span proof here is the field-write and observe tiers; inline-hook code generation, which depends on the instruction set and has its own coverage story, is scoped separately and is not folded into this claim. We would rather ship a precise claim you can lean on than a broad one you find out was hollow on a live engagement.
Try it on the newest Android
If you have an Android 15 or 16 app or emulator and want to actually watch what it does, download Rutken and attach. The static analysis is free and needs no device at all.
Frequently asked questions
Does it work on Android 15 and Android 16? Yes, device-proven on both (API 35 and 36). The field-write and observe tiers land, and after the deadlock fix above, the host receives events cleanly (70 and 60 events respectively on our test run).
Do I need root? No for observing a normal app. The agent flips the app into a Java-debuggable state at runtime, from inside its own process, rather than requiring a rooted device. We proved the full field-write chain on a stock, unrooted phone.
Why do so many tools break on a new Android release? Because the internal ART symbols they depend on are not a stable API: they move, change visibility, or change meaning (like the debuggable flip at API 34). A tool that hardcodes offsets or assumes a symbol's presence breaks silently. A version gate that resolves against the live binary does not.
Is this Frida? No. It is our own agent and version gate, built specifically so a new Android release does not silently break instrumentation. We wrote separately about why we built our own hooking engine rather than scripting on top of someone else's.
What about older Android? The same agent reaches API 28 (Android 9) and API 29 (Android 10) via the AttachAgent route, so the whole 9-to-16 span is one mechanism, not a patchwork.