Help for Realm® apps / Build errors

@realm/react pulls a second react-native: Failed to apply plugin 'com.facebook.react.rootproject'

Your Android build fails while Gradle configures the project. @realm/react 0.20.0 can pull in its own copy of react-native, and the build picks the wrong one.

Updated 9 November 2026.

The error

* What went wrong:
A problem occurred evaluating root project '…'.
> Failed to apply plugin 'com.facebook.react.rootproject'.
   > A problem occurred configuring project ':app'.
      > Failed to notify project evaluation listener.
         > /…/node_modules/react-native/sdks/hermes-engine/version.properties (No such file or directory)

yarn why react-native shows a second copy under @realm/react:

@realm/react@npm:0.20.0 └─ react-native@npm:0.82.0 (via npm:>=0.68)

When it happens

  • @realm/react 0.20.0, the last release (17 October 2025), in an Android build.
  • Reported in #7066 (18 October 2025) with React Native 0.81.4, realm 20.2.0 and Yarn 3.6.4. Another user reported the same.

Why

@realm/react 0.20.0 lists react-native (>=0.68) in its optionalDependencies. Your package manager may then install another react-native version in node_modules/@realm/react/node_modules, and React Native's Gradle plugin uses the wrong copy.

Fix with afterdb

@pomwik/afterdb-react declares react-native as an optional peer dependency instead, so it never installs its own copy.

In package.json, point the two Realm packages to afterdb:

"realm": "npm:@pomwik/afterdb@20.3.0",
"@realm/react": "npm:@pomwik/afterdb-react@0.20.1"

Then reinstall, run pod install on iOS, and rebuild. For Expo dev builds, run npx expo prebuild --clean. Your code keeps import Realm from "realm". If you do not use @realm/react, the first line is enough.

afterdb is an independent open-source fork of the realm-js SDK v20 (Apache-2.0) that we maintain, for apps on realm 20.x without Device Sync. It is not an official Realm release. Code on GitHub, package on npm.

You can check the change with npm view @pomwik/afterdb-react peerDependenciesMeta. The Yarn 3.6.4 setup from #7066 is not in our test matrix.

Without afterdb

  • Pin react-native to your app's version. With Yarn, in package.json:
    "resolutions": {
      "react-native": "your react-native version"
    }
    The author of #7066 posted this and confirmed it works.
  • With npm, the same idea uses overrides. We have not tested it.
  • yarn dedupe did not help the author.

Need help? Send your versions and the full error for a free 15-minute check. We reply within 12 hours.