File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
packages/repack/android/src/main/java/com/callstack/repack Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change @@ -2,12 +2,16 @@ package com.callstack.repack
22
33import android.os.Handler
44import com.facebook.react.bridge.*
5+ import com.facebook.soloader.SoLoader
56
67class ScriptManagerModule (reactContext : ReactApplicationContext ) : ScriptManagerSpec(reactContext) {
78 private val nativeLoader = NativeScriptLoader (reactApplicationContext)
89 private val remoteLoader = RemoteScriptLoader (reactApplicationContext, nativeLoader)
910 private val fileSystemLoader = FileSystemScriptLoader (reactApplicationContext, nativeLoader)
1011
12+ init {
13+ ensureInspectorLoaded()
14+ }
1115 override fun getName (): String {
1216 return NAME
1317 }
@@ -106,6 +110,17 @@ class ScriptManagerModule(reactContext: ReactApplicationContext) : ScriptManager
106110 }
107111
108112 companion object {
113+ @Volatile
114+ private var inspectorLoaded = false
115+
116+ @Synchronized
117+ private fun ensureInspectorLoaded () {
118+ if (BuildConfig .DEBUG && ! inspectorLoaded) {
119+ SoLoader .loadLibrary(" reactnativejni" )
120+ inspectorLoaded = true
121+ }
122+ }
123+
109124 init {
110125 System .loadLibrary(" callstack-repack" )
111126 }
You can’t perform that action at this time.
0 commit comments