Sanniv Khare 7 min read

Android 18 vs 30 React Native libraries: what the sources show

Android 18 vs 30 React Native libraries: what the sources show

Android 18 Beta 1 changes the runtime for every app: MessageQueue is lock-free and its private fields read as null under reflection, ART refuses synchronized on value-based classes such as Integer, sealed hierarchies are verified at load time, and garbage collection is time-based. The worry for React Native teams is that this code lives in dependencies, not in the app.

The takeaway: in the Android sources that ship on npm for React Native 0.88.1, 0.89.0-rc.5 and 30 widely used libraries (latest versions on 5 Dec 2026), we found no reflection on MessageQueue, no locking on value-based classes and no use of the deprecated PackageManager.addPermission(). The only hits are explicit garbage collection calls: one in React Native’s dev-only reload path and one in an opt-in buffering mode of react-native-video. You do not need to wait for library updates on these four changes. The SDKs those libraries pull from Maven are a separate question, covered below.

Why we did this: Beacon-type banking apps and our TV apps run React Native on Android, and the first question on any new Android beta is whether we can test our own code or have to wait for twenty libraries first.

The four changes we looked for

From the Android 18 Beta 1 announcement of 4 Dec 2026, the runtime changes that can sit inside library code:

Change Applies to What breaks Pattern we searched
Lock-free MessageQueue All apps, any targetSdk Private fields such as mMessages return null under reflection mMessages, getDeclaredField("mQueue") and friends
No monitors on value-based classes Apps running on and targeting Android 18 "java.lang.Integer is not an identity class" at runtime Every synchronized(...) target, resolved to its declared type
Sealed class verification All apps on Android 18 VerifyError when sealed types load through different class loaders DexClassLoader, PathClassLoader, InMemoryDexClassLoader, classes extending ClassLoader
Time-based GC All apps on Android 18 Nothing crashes; Google asks apps to avoid idle System.gc() and not to read totalMemory() as a GC signal System.gc(), runtime.gc(), totalMemory()
addPermission() deprecated Not stated as target-specific Will become a no-op in a future release addPermission(, addPermissionAsync(, removePermission(

Two items on Google’s list are not about library code at all (implicit URI grants for apps targeting API 38, covered in our Android 18 Beta 1 post, and the per-process soft memory limits for background services), so they are not part of this scan.

How we scanned

We ran npm pack for each package at its latest tag (React Native also at next), unpacked the tarballs and walked every .kt and .java file under an Android path: 32 packages, 3,024 files. A short Python script matched the patterns above and, for each of the 309 synchronized(...) blocks, looked up how the locked variable is declared. The core of the script is below. We then read every block whose target was not this or a class literal, and every pattern hit, by hand.

import os, re, sys
root = sys.argv[1]
pats = {
  "mq-reflect": re.compile(r'mMessages|getDeclaredField\(\s*"m(Queue|Messages|Next)"'),
  "gc": re.compile(r'System\.gc\(\)|\.gc\(\)'),
  "totalMemory": re.compile(r'totalMemory\(\)'),
  "addPermission": re.compile(r'\b(addPermission|addPermissionAsync|removePermission)\('),
  "classloader": re.compile(r'\b(Dex|Path|InMemoryDex|BaseDex)ClassLoader\b|extends\s+ClassLoader\b'),
}
sync = re.compile(r'synchronized\s*\(\s*([A-Za-z_][\w.]*)\s*\)')
for dp, _, files in os.walk(root):
    if "android" not in dp.lower():
        continue
    for f in files:
        if not f.endswith((".kt", ".java")):
            continue
        path = os.path.join(dp, f)
        for n, line in enumerate(open(path, errors="ignore"), 1):
            for name, rx in pats.items():
                if rx.search(line):
                    print(name, path, n, line.strip()[:120])
            for m in sync.finditer(line):
                print("sync", m.group(1), path, n)
Terminal summary of the Android 18 pattern scan across 32 npm packages

Summary of the scan of the npm tarballs, 5 Dec 2026.

What we found, package by package

Package Version .kt/.java files Result
react-native 0.88.1 748 1 System.gc(), dev reload only
react-native 0.89.0-rc.5 756 Same System.gc(), unchanged
expo-modules-core 58.2.1 299 Clean
react-native-vision-camera 5.2.5 245 Clean
react-native-screens 4.31.0 242 Clean
react-native-svg 15.16.2 117 Clean
react-native-maps 1.29.11 96 Clean
react-native-video 6.20.0 64 totalMemory() and runtime.gc() in one opt-in mode
react-native-gesture-handler 3.5.1 59 Clean
@react-native-firebase/app 27.2.0 56 One custom ClassLoader, in a unit test
@sentry/react-native 8.38.0 43 Clean
react-native-reanimated 4.8.1 37 Clean
react-native-share 12.3.1 31 Clean
react-native-keychain 11.0.0 28 Clean
react-native-webview 14.0.1 27 Clean
react-native-safe-area-context 5.11.1 24 Clean
react-native-blob-util 1.2.0 23 Clean
@react-native-firebase/messaging 27.2.0 17 Clean
react-native-nitro-modules 0.37.2 17 Clean
@react-native-google-signin/google-signin 17.0.0 14 Clean
@react-native-community/netinfo 12.0.1 11 Clean
react-native-worklets 0.14.1 11 Clean (locks on AtomicBoolean, an identity class)
react-native-image-picker 8.3.0 10 Clean
react-native-fs 2.20.0 9 Clean
lottie-react-native 7.5.1 8 Clean
@react-native-async-storage/async-storage 3.1.1 8 Clean
react-native-device-info 15.0.2 7 Clean
react-native-config 1.7.2 5 Clean
react-native-mmkv 4.3.2 4 Clean
react-native-permissions 5.7.0 4 Clean
react-native-purchases 12.1.0 4 Clean
@shopify/flash-list 2.3.3 0 No Android sources (JavaScript only)

Locks: every target is an identity object

Of the 309 synchronized blocks, 84 lock this and 2 lock a class literal. The rest lock fields declared as Any(), Object(), collections (HashMap, ArrayList, HashSet, SparseArray), AtomicBoolean or AtomicReference, or library objects such as React Native’s ModuleHolder. The two that looked suspicious at first, synchronized(mPaused) and synchronized(mActive) in react-native-worklets, lock AtomicBoolean instances, which are ordinary identity objects. None of them is a boxed Integer, Long or Boolean, which is what the Android 18 error message names.

MessageQueue: React Native’s queue is its own class

React Native’s sources mention MessageQueue dozens of times, all as MessageQueueThread, React Native’s own wrapper around a Looper (65 occurrences in the C++ side alone). Nothing reads fields of android.os.MessageQueue. The one hit in react-native-screens, postLayoutToMessageQueue(), is a method name in its tabs layout coordinator.

The explicit GC calls

React Native calls System.gc() in DevSupportManagerBase.onReactInstanceDestroyed, with a comment explaining it tries to collect JNI hybrid objects eagerly after a reload. That runs on a dev reload, not in a release build’s normal path, and the line is identical in 0.88.1 and 0.89.0-rc.5.

The one runtime hit worth reading is in react-native-video:

react-native-video code that computes used memory from totalMemory and calls runtime.gc when free memory reaches zero

The block only runs with bufferingStrategy="DependingOnMemory"; the default strategy skips it.

BufferingStrategy.parse returns Default when the prop is not set, so most apps never reach this code. When it is set, the first part is fine under Android 18: Google says the live allocation footprint is still totalMemory() minus freeMemory(), which is exactly how the library computes usedMemory. The explicit runtime.gc() when freeMemory() reaches zero is the pattern Google now asks apps to avoid. It is not a crash risk, but if you use that buffering mode, profile playback on the Android 18 beta before assuming the old buffering behaviour holds.

Class loaders and sealed types

The only custom class loader is IsolatedSharedUtilsLoader in a React Native Firebase unit test under src/test, which never ships in an app. No library loads DEX code at runtime. The sealed-class checks matter mostly for your own instrumented tests: Google calls out mocking a sealed class or interface with Mockito as an affected case.

What this scan does not cover

  • SDKs pulled from Maven. Most of these libraries are thin bridges. react-native-purchases has 4 Kotlin and Java files because RevenueCat’s Android SDK comes from Maven; the same goes for the Firebase Android SDK, Media3 behind react-native-video, the Sentry Android SDK, MMKV’s core and the Google Maps SDK. React Native itself normally reaches apps as the prebuilt react-android artifact from Maven Central; the npm tarball carries its source tree. Compiled SDKs need the checks Google suggests: the dex2oat check for explicit synchronization on the APK you ship, and a run on the beta.
  • Native C++ code in these packages, apart from the MessageQueue search.
  • Runtime behaviour. This is a source scan. Lock-free queue timing and the new GC can only be judged on a device running the beta.
  • Your own code. Run the same script over android/app/src; it takes any directory.

What to do this week

  1. Run the scan over your app’s android/ folder and any local native modules; the libraries above are not where the risk is.
  2. Update Espresso and Robolectric, as Google asks, before running UI tests on Android 18.
  3. If you use react-native-video with DependingOnMemory, add an Android 18 beta playback session to your test plan.
  4. Build a release APK with your real R8 settings and run it on the beta image; that covers the Maven SDKs this scan cannot see.

React Native 0.89.0-rc.5 changes nothing here compared with 0.88.1, so the Android 18 question does not need to drive the timing of that upgrade. For the iOS side of the same release train, see our look at react-native-screens 4.31 and Swift Package Manager.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.