From 53e3def7869c48fe2449b8845182e84e32477c84 Mon Sep 17 00:00:00 2001 From: Jakob Malmo Date: Tue, 5 May 2026 00:29:58 +0200 Subject: [PATCH] fix(android): detect newArchEnabled at subproject scope `isNewArchitectureEnabled()` reads `rootProject.hasProperty("newArchEnabled")`. On RN >= 0.82 with Expo SDK 55 the new architecture is mandatory and the property is no longer required to live in `android/gradle.properties`; React Native's `ReactRootProjectPlugin` instead sets `newArchEnabled=true` on each subproject's `extraProperties`. The rootProject-scoped check therefore returns false in that scenario, the library skips `apply plugin: "com.facebook.react"`, no codegen tasks register, and the consumer build fails at `:app:configureCMakeDebug` referencing the missing `node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/`. Switch the helper to `project.hasProperty("newArchEnabled")`. That covers both the RN >= 0.82 path (subproject extraProperties) and the legacy explicit-opt-in path (`gradle.properties` values propagate to every project), without dropping legacy-arch support. Same fix and rationale as mrousavy/nitro#1314, applied to mmkv's own build.gradle which carries an independent copy of the gate from Nitrogen's `packages/template` at bootstrap time. --- packages/react-native-mmkv/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-mmkv/android/build.gradle b/packages/react-native-mmkv/android/build.gradle index 32a95100..9c906c2c 100644 --- a/packages/react-native-mmkv/android/build.gradle +++ b/packages/react-native-mmkv/android/build.gradle @@ -15,7 +15,7 @@ def reactNativeArchitectures() { } def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" + return project.hasProperty("newArchEnabled") && project.getProperty("newArchEnabled") == "true" } apply plugin: "com.android.library"