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

setEventEmitterCallback NoSuchMethodError during app startup on Android API 26 #48009

Open
leoogh opened this issue Nov 28, 2024 · 0 comments
Open
Labels
Needs: Triage 🔍 Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@leoogh
Copy link

leoogh commented Nov 28, 2024

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

    • should build and then crash the app on the simulator with errors mentioned above
  • 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

System:
  OS: macOS 14.7.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 79.28 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.9.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.10.14.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.3
    wanted: 0.76.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

2024-11-28 18:42:59.661  4242-4286  ReactNativeJS           com.reproducerapp                    I  Bridgeless mode is enabled
2024-11-28 18:42:59.664  4242-4286  ReactNativeJS           com.reproducerapp                    I  Running "ReproducerApp" with {"rootTag":11,"initialProps":{},"fabric":true}
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504] 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"
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void com.facebook.jni.NativeRunnable.run() (NativeRunnable.java:-2)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(android.os.Message) (MessageQueueThreadHandler.java:27)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void android.os.Looper.loop() (Looper.java:164)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(com.facebook.react.common.futures.SimpleSettableFuture) (MessageQueueThreadImpl.java:217)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run() (D8$$SyntheticClass:0)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]   at void java.lang.Thread.run() (Thread.java:764)
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504] 
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]     in call to IsAssignableFrom
2024-11-28 18:42:59.832  4242-4286  zygote64                com.reproducerapp                    A  java_vm_ext.cc:504]     from void com.facebook.jni.NativeRunnable.run()

Reproducer

https://github.com/leoogh/RNBugRepro1

Screenshots and Videos

No response

@leoogh leoogh added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Nov 28, 2024
@react-native-bot react-native-bot added the Platform: Android Android applications. label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

2 participants