-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
setEventEmitterCallback NoSuchMethodError during app startup on Android API 26 #48009
Comments
Facing same issue. Did anyone have any update on how to solve this ? |
As an immediate workaround, you can add the following in the module code: class CalcturboModule(reactContext: ReactApplicationContext) :
NativeCalcturboSpec(reactContext) {
+ private fun setEventEmitterCallback(eventEmitterCallback: CxxCallbackImpl) {
+ super.mEventEmitterCallback = eventEmitterCallback
+ }
} I verified that the crash disappears. |
Will try it thank you for the information and help |
the above solution works for me thnx |
Summary: Fixes facebook#48009 The app is currently crashing on Android API lvl 26 attempting to invoke the method `setEventEmitterCallback` which is defined inside BaseJavaModule. I'm not entirely sure why this is happening only for API lvl 26, but I've verified that by having the method protected, this doesn't happen anymore. The visibility is consistent with the field `mEventEmitterCallback` which is also protected and accessed to codegen. So let's keep them aligned for consistency. Changelog: [Android] [Fixed] - Fix crash for setEventEmitterCallback NoSuchMethodError on API lvl 26 Differential Revision: D68018506
This is going to be fixed for good with #48606 in React Native 0.78 |
Description
Using the event emitter support in a RN 0.76.3 Turbo Module, the simulator or device crashes during app startup, with logcat error:
JNI DETECTED ERROR IN APPLICATION: JNI IsAssignableFrom called with pending exception java.lang.NoSuchMethodError: no non-static method "Lcom/calcturbo/CalcturboModule;.setEventEmitterCallback(Lcom/facebook/react/bridge/CxxCallbackImpl;)V"
This only happens when using Android API 26 (Oreo 8.1).
When using API 27 or higher it works fine. App runs also fine on iOS
Steps to reproduce
prerequisites: Android SDK 35 was installed and RN apps can be built on your mac
clone the git repo
cd ./ReproducerApp
if not installed yet, install yarn with
npm i -g yarn
yarn
start an android simulator with api 26 (Oreo 8.0)
npx react-native run-android
switch to another android simulator with api 27 (Oreo 8.1)
npx react-native run-android
should build and run fine
React Native Version
0.76.3
Affected Platforms
Runtime - Android
Areas
TurboModule - The New Native Module System
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/leoogh/RNBugRepro1
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: