Missing Realm constructor. Did you run "react-native link realm"? Please(...)
See original GitHub issueGoals
Build under Ubuntu, on Android emulator, simple react-native project, which imports realm
Expected Results
Application runs without problems
Actual Results
Emulator(red screen of death): Missing Realm constructor. Did you run “react-native link realm”? Please see https://realm.io/docs/react-native/latest/#missing-realm-constructor for troubleshooting
Console: Missing Realm constructor. Did you run “react-native link realm”? Please see https://realm.io/docs/react-native/latest/#missing-realm-constructor for troubleshooting Module AppRegistry is not a registered callable module (calling runApplication)
Steps to Reproduce
Install Ubuntu 17.04/ get RN up and running/ using Webstorm create new RN project/ add import realm from 'realm' line to your code/ run react-native link realm and check that everything is linked properly/try building
Code Sample
MainApplication.java
import io.realm.react.RealmReactPackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RealmReactPackage()
);
}
...
settings.gradle
...
include ':realm'
project(':realm').projectDir` = new File(rootProject.projectDir, '../node_modules/realm/android')
...
build.gradle
...
dependencies {
compile project(':realm')
...
Version of Realm and Tooling
- Realm JS SDK Version: 1.13.0
- Node: 6.11.2
- React Native: 0.49.3
- Client OS & Version: Ubuntu 17.04
- React: 16.0.0-beta.5
- Web Storm: 2017.2.2
Remarks
Other module, specifically SplashScreenReactPackage which also needs adding package to getPackages() in MainApplication.java works correctly.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:33 (7 by maintainers)

Top Related StackOverflow Question
I had the same problem today. I managed to get it working by:
react-native ejectreact-native linkAre you using
wix/react-native-navigation? If you are there will be 2getPackages()methods in yourMainApplication.java, do make sure both methods are returningnew RealmReactPackage().