Skip to content

Commit 518b6ef

Browse files
fix: ensure SoLoader library is loaded in debug mode
1 parent 1fb1665 commit 518b6ef

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.changeset/warm-tips-marry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
fix(android): load inspector libraries on initialization
6+
7+
Fixes `UnsatisfiedLinkError` on React Native 0.80 and above by loading inspector libraries when `ScriptManagerModule` is initialized.

packages/repack/android/src/main/java/com/callstack/repack/ScriptManagerModule.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.callstack.repack
22

33
import android.os.Handler
44
import com.facebook.react.bridge.*
5+
import com.facebook.soloader.SoLoader
56

67
class ScriptManagerModule(reactContext: ReactApplicationContext) : ScriptManagerSpec(reactContext) {
78
private val nativeLoader = NativeScriptLoader(reactApplicationContext)
@@ -106,6 +107,17 @@ class ScriptManagerModule(reactContext: ReactApplicationContext) : ScriptManager
106107
}
107108

108109
companion object {
110+
@Volatile
111+
private var inspectorLoaded = false
112+
113+
@Synchronized
114+
private fun ensureInspectorLoaded() {
115+
if (BuildConfig.DEBUG && !inspectorLoaded) {
116+
SoLoader.loadLibrary("reactnativejni")
117+
inspectorLoaded = true
118+
}
119+
}
120+
109121
init {
110122
System.loadLibrary("callstack-repack")
111123
}

0 commit comments

Comments
 (0)