repack icon indicating copy to clipboard operation
repack copied to clipboard

Regression - unable to start debugger

Open ilteoood opened this issue 4 months ago • 13 comments

Describe the bug

I've just tried creating a new project with RePack v5.2.0 and the latest template, but the same applies to my existing project.

Once the app is up and running, when I try to open the debugger the app crashes and from logcat I see the following error:

No implementation found for void com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener.onHeaders(int, java.util.Map) (tried Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders and Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders__ILjava_util_Map_2) - is the library loaded, e.g. System.loadLibrary?
2025-08-29 16:46:27.271 19560-19618 AndroidRuntime          com.foo                              E  FATAL EXCEPTION: OkHttp Dispatcher
                                                                                                    Process: com.foo, PID: 19560
                                                                                                    java.lang.UnsatisfiedLinkError: No implementation found for void com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener.onHeaders(int, java.util.Map) (tried Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders and Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders__ILjava_util_Map_2) - is the library loaded, e.g. System.loadLibrary?
                                                                                                    	at com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener.onHeaders(Native Method)
                                                                                                    	at com.facebook.react.devsupport.inspector.InspectorNetworkHelper$loadNetworkResource$1.onResponse(InspectorNetworkHelper.kt:63)
                                                                                                    	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)

Here is a video which demonstrates it: https://github.com/user-attachments/assets/8798adb7-cb28-44e9-9b7d-b6415dd72fed

System Info

System:
  OS: macOS 15.6.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 116.86 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.16.0
    path: ~/.nvm/versions/node/v22.16.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.16.0/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v22.16.0/bin/npm
  Watchman:
    version: 2025.08.11.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/ilteoood/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "32"
      - "34"
      - "34"
      - "34"
      - "34"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.3
      - 34.0.0
      - 35.0.0
      - 36.0.0
      - 36.0.0
      - 36.0.0
      - 36.1.0
    System Images:
      - android-31 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-36 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2512.13991807
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.15
    path: /Users/ilteoood/.sdkman/candidates/java/current/bin/javac
  Ruby:
    version: 3.4.3
    path: /Users/ilteoood/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.1
    wanted: 0.81.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Re.Pack Version

5.2.0

Reproduction

Create a new empty project

Steps to reproduce

  • Create a new empty project
  • Install the deps
  • Open the debugger

ilteoood avatar Aug 29 '25 14:08 ilteoood

I've just checked this and confirmed this is an issue on Android only 👍

jbroma avatar Aug 29 '25 15:08 jbroma

@ilteoood seems like it might be related to this PR from RN Core: https://github.com/facebook/react-native/pull/53036

could you try if patching with the changes from the PR above fixes the issue?

jbroma avatar Aug 29 '25 15:08 jbroma

Yes, I tried it without any luck. If this helps you, creating a new project with metro (and the same RN version) works without issues.

ilteoood avatar Aug 29 '25 15:08 ilteoood

I've been able to find where the issue gets triggered. By removing the sendMessage, the InspectorNetworkHelper doesn't get involved so the debugger can be opened without issues.

As usual, I would like to contribute to the fix, but in this scenario I'm a bit stuck: this piece of code seems to be related to module federation 🤔

ilteoood avatar Sep 01 '25 16:09 ilteoood

I've been able to find where the issue gets triggered. By removing the sendMessage, the InspectorNetworkHelper doesn't get involved so the debugger can be opened without issues.

As usual, I would like to contribute to the fix, but in this scenario I'm a bit stuck: this piece of code seems to be related to module federation 🤔

yes, I managed to track it down to that place as well, it was slightly hacky in the first place 👍 I'll try to ask around for a proper workaround this time around 😅

jbroma avatar Sep 02 '25 07:09 jbroma

sorry for the delay @ilteoood, was slightly busy with the conference last week, I'll look into this more deeply this week

jbroma avatar Sep 09 '25 10:09 jbroma

No worries, for the time being I've patched that piece of code and removed it

ilteoood avatar Sep 09 '25 11:09 ilteoood

@ilteoood If possible, can you share exactly what you did to be able to use the debugger? I have the same issue here

raulsvilar avatar Oct 10 '25 17:10 raulsvilar

I created a patch to remove the code shared above

ilteoood avatar Oct 10 '25 17:10 ilteoood

Hi @ilteoood how did you create the patch, if you don't mind sharing?

vickylance avatar Nov 15 '25 11:11 vickylance

Hi @ilteoood how did you create the patch, if you don't mind sharing?

Hi! It depends a lot on the package manager you are using. Pnpm and yarn, for example, support it by default

ilteoood avatar Nov 15 '25 12:11 ilteoood

Hi @ilteoood I created a new project using bun

vickylance avatar Nov 16 '25 07:11 vickylance

workaround:

android/app/src/main/java/..../MainApplication.kt

import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
override fun onCreate() {
    super.onCreate()
    SoLoader.init(this, OpenSourceMergedSoMapping)

    /*
    * Regarding next lint.
    * There's an open issue regarding this https://github.com/callstack/repack/issues/1299.
    * This line is generally unnecessary and will need
    * to be removed when we migrate to RN 0.82+,
    * but as a temporary solution, it will prevent
    * a crash when opening the debugger.
    */
    SoLoader.loadLibrary("reactnativejni")
    ...

Feofilov avatar Dec 11 '25 19:12 Feofilov

@Feofilov can you explain this change, what does it do? Like why does that fix work around this issue?

dannyhw avatar Dec 16 '25 23:12 dannyhw

@Feofilov can you explain this change, what does it do? Like why does that fix work around this issue?

If you open the android device log at the time of this crash, you will most likely see something like this:

java.lang.UnsatisfiedLinkError:
No implementation found for void
com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener.onHeaders(int, java.util.Map)

This is a JNI crash: the Java class expects a native implementation of onHeaders(), but the corresponding function isn't found/loaded in the .so file.

And here is the actual fix for this - https://github.com/facebook/react-native/pull/53036/changes As an alternative, you can use the patch for react-native based on this pull request.

Feofilov avatar Dec 16 '25 23:12 Feofilov