0

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

enter image description here

James Z
12.3k10 gold badges27 silver badges50 bronze badges
asked Sep 24, 2024 at 7:41

1 Answer 1

0

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.

answered Sep 24, 2024 at 8:00
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your Answer. I try this but not working show same error as before. No implementation found for void videoplayer.movies.videoeditor.hd.mpv.MPVLib.create(android.content.Context) (tried Java_videoplayer_movies_videoeditor_hd_mpv_MPVLib_create and Java_videoplayer_movies_videoeditor_hd_mpv_MPVLib_create__Landroid_content_Context_2) - is the library loaded, e.g. System.loadLibrary? at videoplayer.movies.videoeditor.hd.mpv.MPVLib.create(Native Method)
@SajawalHussain You can find codes that may contain lib prefixes and .so suffixes by pressing Ctrl+Shift+F and entering System.loadLibrary.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.