realm-js
realm-js copied to clipboard
MongoDB Atlas Device Sync (Realm) with expo in 2025
Hi! I’m migrating my existing react-native project into Expo. I am using Realm 11 and @realm/react 0.4.2. It will compile, but gives me a runtime error: ‘Missing Realm Constructor, Did you run pod-install?’. We have installed our dependencies using expo prebuild and later also by hand in our iOS directory.
I know realm/device sync is deprecated, and we are moving away from it, but it would be really helpful for my project to be able to migrate our existing realm setup into our new expo-managed app for some time.
The started kit that MongoDB provides seems dated and does not include any documentation.
My question: Does anyone have recent experience in bringing Realm into expo projects, and/or can anyone help me with fixing this error?
I suspect you're hitting https://github.com/realm/realm-js/issues/6933#issuecomment-2479451888
@kraenhansen I think I indeed am, however the fix suggested in #6933 does not solve my problem. Could continue the conversation here, or in the other issue?
For anyone still having this problem I managed to fix it for my project, I went from Expo v51 to v53 and the fix suggested in #6933 didn't work for me.
What worked for me was enabling the useLegacyPackaging parameter for expo-build-properties and adding extra proguard rules as well.
{
"expo": {
...
"plugins": [
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 35,
"targetSdkVersion": 34,
"useLegacyPackaging": true,
"enableProguardInReleaseBuilds": true,
"extraProguardRules":
"-keep class io.realm.** { *; }\n-keep class io.realm.react.** { *; }\n-dontwarn java.beans.**\n-dontwarn javax.xml.bind.**"
}
}
]
],
...
}
}
In the proguard rules we're making sure that none of the realm files are stripped, and also making sure it doesn't fail when it doesn't find some java stubs used by jackson.
Might not be the best method but did work in my case. Hope this helps!