Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v12.0.0-alpha.1 Exception in HostObject::get for prop 'Realm': java.lang.NoClassDefFoundError: io.realm.react.RealmReactModule #5666

Closed
RalissonMattias opened this issue Mar 29, 2023 · 6 comments

Comments

@RalissonMattias
Copy link

RalissonMattias commented Mar 29, 2023

How frequently does the bug occur?

Always

Description

When i use new Realm({schema: [TaskSchema]}) the app crashes in android

Stacktrace & log output

Error: Exception in HostObject::get for prop 'Realm': java.lang.NoClassDefFoundError: io.realm.react.RealmReactModule, js engine: hermes
 LOG  Running "realmAlpha1" with {"rootTag":41}
 ERROR  Invariant Violation: "realmAlpha1" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Can you reproduce the bug?

Always

Reproduction Steps

  1. npx react-native init projectName
  2. yarn add realm@next
  3. yarn add bson and react-native-get-random-values. Obs: I needed to add these libraries. Without these libraries, the project crashes
  4. Add this line import react-native-get-random-values in App.tsx
  5. Try to use new Realm({schema: [schemas]}). The app crashes in sequence

Version

12.0.0-alpha.1

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 12

Build environment

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M2
    Memory: 62.27 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
    Watchman: 2023.02.20.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.0 - /Users/ralissonmattias/.rvm/gems/ruby-2.7.6/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-30 | Google Play ARM 64 v8a, android-31 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.5 => 0.71.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Cocoapods version

1.12.0

@kraenhansen
Copy link
Member

kraenhansen commented Mar 29, 2023

Thank you for taking this for a spin!

  • Can you share the code you use to initialize TaskSchema? Perhaps even a repo reproducing this?
  • How do you import Realm?
  • We've built the prebuild native module against the jsi.h from React Native v0.71.4 and I do see some changes in that introduced in v0.71.5 - can I have you try downgrading the React Native version?

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Mar 30, 2023
@RalissonMattias
Copy link
Author

RalissonMattias commented Mar 30, 2023

Initialize: const realm = new Realm({schema: [TaskSchema]})
Import: import { Realm } from "realm"
I tried to downgrading, but without success
Here is the link of the repo https://github.com/RalissonMattias/realmAlpha

I should try with @realm/react?

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 30, 2023
@kraenhansen kraenhansen changed the title **Alpha** Exception in HostObject::get for prop 'Realm': java.lang.NoClassDefFoundError: io.realm.react.RealmReactModule v12.0.0-alpha.1 Exception in HostObject::get for prop 'Realm': java.lang.NoClassDefFoundError: io.realm.react.RealmReactModule Mar 30, 2023
@kraenhansen
Copy link
Member

kraenhansen commented Mar 31, 2023

Thank you so much for reporting this and taking the time to produce a repro - it was a stupid error on our part with an easy fix. Expect a release in the beginning of next week 👍 (I try to avoid releasing on a Friday).

@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Mar 31, 2023
@kraenhansen
Copy link
Member

@RalissonMattias unfortunately we're experiencing a different regression, preventing us from building the Node.js Windows ia32 native module, that we need to fix before the release of this fix can be published.

@RalissonMattias
Copy link
Author

@RalissonMattias unfortunately we're experiencing a different regression, preventing us from building the Node.js Windows ia32 native module, that we need to fix before the release of this fix can be published.

Thanks for letting me know, I'm waiting🚀😃

@kraenhansen
Copy link
Member

@RalissonMattias we managed to fix that other issue and the fix for this issue is now published as 12.0.0-alpha.2. I hope you're willing and able to take it for a spin 🙂 Thanks again for reporting this!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants