i have this error which i m using in my code i m trying to load lib but it doesn't load
i m using mpv player and i have libmpv.so files
this is what i m doing in my code
public class MPVLib {
static {
String[] libs = { "mpv", "player" };
for (String lib: libs) {
System.loadLibrary(lib);
}
}
i get this issue
FATAL EXCEPTION: main Process: videoplayer.movies.videoeditor.hd, PID: 25984
java.lang.UnsatisfiedLinkError: dlopen failed: library "liblibmpv.so.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
at java.lang.System.loadLibrary(System.java:1661)
at videoplayer.movies.videoeditor.hd.mpv.MPVLib.<clinit>(MPVLib.java:18)
at videoplayer.movies.videoeditor.hd.mpv.MPVView.removeObserver(MPVView.kt:220)
at videoplayer.movies.videoeditor.hd.mpv.MPVActivity.onDestroy(MPVActivity.kt:735)
at android.app.Activity.performDestroy(Activity.java:9049)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1510)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5971)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:6022)
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:47)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:185)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2643)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
my gradle is this
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-android")
id("kotlin-kapt")
id("com.google.gms.google-services")
}
// Define abiCodes and universalBase as top-level variables
android {
namespace = "videoplayer.movies.videoeditor.hd"
compileSdk = 34
ndkVersion = "27.1.12297006"
defaultConfig {
applicationId = "videoplayer.movies.videoeditor.hd"
minSdk = 24
targetSdk = 34
versionCode = 10
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
// Specify the architectures you want to support
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64"))
}
}
bundle {
language {
enableSplit = false
}
}
and this is jni libs
1 Answer 1
java.lang.UnsatisfiedLinkError: dlopen failed: library "liblibmpv.so.so" not found
According to the logs, it seems you added prefix lib and suffix .so keywords to the library names. You don't need to add them manually, it just needs the name. So it should be like this.
System.loadLibrary("mpv");
So the first snippet you provided should work fine. Please also ensure that prefixes and suffixes are removed in other codes that attempts to load libraries.
2 Comments
lib prefixes and .so suffixes by pressing Ctrl+Shift+F and entering System.loadLibrary.