question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing Realm constructor. Did you run "react-native link realm"? Please(...)

See original GitHub issue

Goals

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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:33 (7 by maintainers)

github_iconTop GitHub Comments

11reactions
damir-sirolacommented, Oct 12, 2017

I had the same problem today. I managed to get it working by:

  1. deleting ios and android folder
  2. recreating them with react-native eject
  3. link dependencies again with react-native link
6reactions
gusterwoei-veltracommented, Jan 24, 2018

Are you using wix/react-native-navigation? If you are there will be 2 getPackages() methods in your MainApplication.java, do make sure both methods are returning new RealmReactPackage().

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing Realm constructor. Did you run "react-native link ...
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via...
Read more >
Missing Realm constructor. Did you run "pod install"? (I'm ...
In your project folder run npm install realm . It adds the npm package to your react native project; In your iOS folder...
Read more >
React Native SDK with Expo - "Missing Realm constructor" error
According to the latest documentation for MongoDB Realm React Native, it states that their SDK is compatible with Expo…
Read more >
Someone else have tried to implement Realm in an Expo ...
Error: Missing Realm constructor. Did you run "pod install"? Please see https://realm.io/docs/react-native/latest/#missing-realm-constructor ...
Read more >
Using Hermes - React Native
Hermes is an open-source JavaScript engine optimized for React Native. For many apps, using Hermes will result in improved start-up time, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found