Google shipped Android 18 Beta 1 (API level 38, build DP21.261120.004) on 4 December 2026. Most of the changes that matter land on every app that runs on it, whatever your targetSdkVersion says. The short version: stop reflecting into MessageQueue, never lock on a boxed value, update Espresso and Robolectric, stop calling System.gc(), and read Runtime.totalMemory() differently. Only one change in this beta is tied to targeting API 38: implicit URI grants on share and capture intents, which Beta 1 does not enforce yet.
Below is the checklist, built from Google’s Android 18 Beta 1 announcement and the Android 18 features page, plus a small scan script. We ran it on six of Google’s open-source Android samples (1,306 Kotlin and Java files) to see what a real codebase turns up.
Why we did this: our Android TV app BMDB, Peepal and Shopkeeper, and the React Native banking apps we build for clients, all ship on Android. A beta that changes threading and memory behaviour for every installed app is the one to read before users start installing it.
The timeline
Betas arrive roughly every two weeks, so Beta 2 should land around 18 December. Google targets Platform Stability for February 2027, and says the Q2 release is the only one with planned app-breaking behaviour changes. Devices on the Android 17 QPR3 beta who want the stable release should opt out and wait, not install Beta 1. You can test on an enrolled Pixel or on the 64-bit emulator images.
What changes, and who it hits
Every row links to Google’s own text.
| Change | Who | What you see | What to do |
|---|---|---|---|
| Lock-free MessageQueue | All apps | Reflection on private fields such as mMessages returns null |
Use Looper logging or ProfilingManager; update Espresso and Robolectric |
| Sealed class checks in ART | All apps | VerifyError at class load |
Check dynamic DEX loading, custom ClassLoaders, bytecode instrumentation, mocks of sealed types |
| No locking on value-based classes | Apps running on and targeting 18 | java.lang.Integer is not an identity class |
Lock on a plain Any() / Object() |
| Time-based GC | All apps | Runtime.totalMemory() reports the heap growth limit |
Measure totalMemory() - freeMemory(); drop System.gc() |
| Soft memory limits for background services | Apps with a service and no visible UI | Rolling out during the beta; crossing the soft limit alone does not kill the app | Check with adb shell am memory-limiter status |
| Permission tree APIs deprecated | All apps | addPermission(), addPermissionAsync(), removePermission() will become no-ops |
Declare permissions in the manifest |
| Implicit URI grants removed | Apps targeting 38 | Receiver cannot read your EXTRA_STREAM or EXTRA_OUTPUT URI |
Add FLAG_GRANT_READ_URI_PERMISSION (and WRITE for capture) |
Two more platform changes need no code but can show up in screenshots: Skia now decodes PNG with a Rust codec in place of libpng, and generic font families such as sans-serif map to the font the device maker configured, so layouts that assume Roboto metrics can shift.
The scan script
Each check is a ripgrep pattern over .kt and .java files. A hit is a place to read, not a bug.
#!/usr/bin/env bash
# Android 18 Beta 1 pre-flight scan. Usage: a18-scan.sh <repo-dir>
set -u
cd "${1:-.}"
src=(--type-add 'src:*.{kt,java}' -t src)
check() { printf '%-34s %s\n' "$1" "$(rg -c "${src[@]}" -e "$2" . 2>/dev/null | awk -F: '{s+=$2} END{print s+0}')"; }
check "MessageQueue reflection" 'mMessages|MessageQueue::class\.java\.getDeclaredField|MessageQueue\.class\.getDeclaredField'
check "synchronized blocks (review)" 'synchronized\s*\('
check "lock typed as a boxed value" '(val|var|private|final)\s+\w*[Ll]ock\w*\s*(:\s*)?(Integer|Boolean|Long|Int\b|Any\s*=\s*\d)|new (Integer|Boolean|Long)\('
check "System.gc()" 'System\.gc\(\)|Runtime\.getRuntime\(\)\.gc\(\)'
check "Runtime.totalMemory()" 'totalMemory\(\)'
check "mocking (sealed classes?)" 'mockk<|mock\(|Mockito\.mock|@Mock\b'
check "custom ClassLoader / DEX" 'DexClassLoader|PathClassLoader|InMemoryDexClassLoader|BaseDexClassLoader'
check "addPermission / removePerm" '\.addPermission(Async)?\(|\.removePermission\('
check "ACTION_SEND with stream" 'EXTRA_STREAM'
check "ACTION_IMAGE_CAPTURE output" 'ACTION_IMAGE_CAPTURE|ACTION_VIDEO_CAPTURE|EXTRA_OUTPUT|TakePicture\(\)|CaptureVideo\(\)'
check "FLAG_GRANT_*_URI_PERMISSION" 'FLAG_GRANT_(READ|WRITE)_URI_PERMISSION'
Grep cannot see the type of a lock object in Kotlin, so the script lists every synchronized( call for a human to read and adds a narrower pattern for fields that look like boxed locks. For locking, the build also helps: Google says dex2oat logs lines such as monitor-enter on value-class (Ljava/lang/Boolean;).
What the scan found on Google’s samples
We ran it on nowinandroid (2982e63), sunflower (2a357a3), architecture-samples (ee66e15), compose-samples (924e1b5), platform-samples (2a01001) and uamp (9498d99), cloned from github.com/android on 5 December 2026.

Real output from our test server: 25 hits in 1,306 Kotlin and Java files, none of them a real Android 18 problem.
What each hit turned out to be:
- 20
synchronized(calls. All lock onthis(sunflower’s and uamp’s singleton getters) or on aMutableMaporMutableList(platform-samples widget repositories, Jetsnack, uamp’s listener list). Those are identity objects, so they are fine. - 1 “boxed lock field”. A false positive:
data class LockState(val isLocked: Boolean)in the UWB sample. Read the hit before you change anything. - 2 capture intents and 1 explicit grant, all in the platform-samples permissions sample. It uses
ActivityResultContracts.TakePicture()andCaptureVideo(), and when it opens the captured photo withACTION_VIEWit already addsFLAG_GRANT_READ_URI_PERMISSION. - 0 for MessageQueue reflection,
System.gc(),totalMemory(), runtime mocks, custom ClassLoaders andaddPermission(). Google’s samples use fakes in tests, not Mockito, so the sealed-class mocking risk does not apply to them.
The pattern matches what Google says: apps built the normal way, with the app and its libraries compiled together, are mostly safe. The risk sits in the code around the app: watchdogs that peek into the main looper, test tooling that mocks sealed types, SDKs that load code at runtime.
The fixes
Locking on a boxed value
In Kotlin, synchronized(lock) on an Int, Boolean or Long field locks on a boxed Integer, Boolean or Long. Google’s beta notes say this now throws.

Lock on an object you own, and make it a val.
// Before: lock is boxed to java.lang.Integer
private var lock: Int = 1
fun add(x: Int) = synchronized(lock) { total += x }
// After
private val lock = Any()
fun add(x: Int) = synchronized(lock) { total += x }
MessageQueue watchdogs
Jank monitors and ANR watchdogs that read mMessages through reflection now get null. Move them to Looper.setMessageLogging() or to ProfilingManager, and update any library that does this for you, test frameworks included.
Memory numbers
With time-based GC on by default, Runtime.totalMemory() reports the heap growth limit, and the ART heap size in dumpsys meminfo looks bigger. If your app logs memory or makes cache decisions from totalMemory(), use totalMemory() - freeMemory() for live allocations. Remove manual System.gc() calls.
Implicit URI grants (targetSdk 38)
When you share a file with ACTION_SEND or ask the camera to write to your URI with ACTION_IMAGE_CAPTURE, the system used to add the read (and for capture, write) grant for you. Apps targeting API 38 must set it themselves.
val share = Intent(Intent.ACTION_SEND).apply {
type = "image/jpeg"
putExtra(Intent.EXTRA_STREAM, uri)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
val capture = Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply {
putExtra(MediaStore.EXTRA_OUTPUT, uri)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
If you use the Jetpack contracts instead: on the androidx main branch (commit e2a0e05, 4 December 2026), TakePicturePreview, TakePicture, CaptureVideo and their siblings in ActivityResultContracts.kt already add both grant flags in createIntent. Check the androidx.activity version you ship does the same before relying on it. To find every place that leaned on the old behaviour, turn on StrictMode.VmPolicy.Builder().detectImplicitUriPermissionGrant() (available since Android 17) and search logcat for Please set the grant explicitly in the app.
What to check on your own app
- Run the script on your repo and read every hit.
- Build with the API 38 SDK and search the
dex2oatoutput formonitor-enter on value-class. - Update Espresso, Robolectric, Mockito and any APM or crash SDK that watches the main thread.
- Run your instrumented tests on the Android 18 emulator image; a
VerifyErrorthere points at a sealed-class mock or a ClassLoader split. - Turn on the URI grant StrictMode check, share a file and take a photo.
- If you have background services, run
adb shell am memory-limiter statusandadb shell dumpsys meminfo <package>on a beta device.
For React Native apps, the same checks apply to every native library in node_modules: our earlier audit of Android 17 and 18 traps in React Native libraries covers that side. For foldables on the current release, see Android 17 QPR2 on foldables.



