Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/warm-tips-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@callstack/repack": patch
---

fix(android): load inspector libraries on initialization

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
Expand Up @@ -2,12 +2,16 @@ package com.callstack.repack

import android.os.Handler
import com.facebook.react.bridge.*
import com.facebook.soloader.SoLoader

class ScriptManagerModule(reactContext: ReactApplicationContext) : ScriptManagerSpec(reactContext) {
private val nativeLoader = NativeScriptLoader(reactApplicationContext)
private val remoteLoader = RemoteScriptLoader(reactApplicationContext, nativeLoader)
private val fileSystemLoader = FileSystemScriptLoader(reactApplicationContext, nativeLoader)

init {
ensureInspectorLoaded()
}
override fun getName(): String {
return NAME
}
Expand Down Expand Up @@ -106,6 +110,17 @@ class ScriptManagerModule(reactContext: ReactApplicationContext) : ScriptManager
}

companion object {
@Volatile
private var inspectorLoaded = false

@Synchronized
private fun ensureInspectorLoaded() {
if (BuildConfig.DEBUG && !inspectorLoaded) {
SoLoader.loadLibrary("reactnativejni")
inspectorLoaded = true
}
}

init {
System.loadLibrary("callstack-repack")
}
Expand Down