xulihang Well-Known Member Licensed User Longtime User Sep 19, 2025 #1 I am trying to include opencv (https://repo1.maven.org/maven2/org/opencv/opencv/4.9.0/opencv-4.9.0.aar) in my project with the following code: B4X: Copy #AdditionalJar: opencv-4.9.0.aar Dim system As JavaObject system.InitializeStatic("java.lang.System") system.RunMethod("loadLibrary",Array("opencv_java4")) But I meet the following error: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libopencv_java4.so" not found What is the correct way to do this? I can load the library using a native android project using System.loadLibaray("opencv_java4") but not with B4A. Last edited: Sep 19, 2025
I am trying to include opencv (https://repo1.maven.org/maven2/org/opencv/opencv/4.9.0/opencv-4.9.0.aar) in my project with the following code: B4X: Copy #AdditionalJar: opencv-4.9.0.aar Dim system As JavaObject system.InitializeStatic("java.lang.System") system.RunMethod("loadLibrary",Array("opencv_java4")) But I meet the following error: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libopencv_java4.so" not found What is the correct way to do this? I can load the library using a native android project using System.loadLibaray("opencv_java4") but not with B4A.
DonManfred Expert Licensed User Longtime User Sep 19, 2025 #2 xulihang said: I can load the library using a native android project using System.loadLibaray("opencv_java") Click to expand... opencv_java and NOT opencv_java4! xulihang said: system.RunMethod("loadLibrary",Array("opencv_java4")) Click to expand... What is the reason to use another name? Upvote 0
xulihang said: I can load the library using a native android project using System.loadLibaray("opencv_java") Click to expand... opencv_java and NOT opencv_java4! xulihang said: system.RunMethod("loadLibrary",Array("opencv_java4")) Click to expand... What is the reason to use another name?
xulihang Well-Known Member Licensed User Longtime User Sep 19, 2025 #3 DonManfred said: opencv_java and NOT opencv_java4! What is the reason to use another name? Click to expand... The correct text is opencv_java4. I misspelled it the post. Upvote 0
DonManfred said: opencv_java and NOT opencv_java4! What is the reason to use another name? Click to expand... The correct text is opencv_java4. I misspelled it the post.
xulihang Well-Known Member Licensed User Longtime User Sep 19, 2025 #4 I see. It is more complicated than I thought: https://www.b4x.com/android/forum/threads/how-to-load-so-libraries-using-inline-java.50827/#content I use the following code to load the library now: B4X: Copy Dim loader As JavaObject loader.InitializeStatic("org.opencv.android.OpenCVLoader") loader.RunMethod("initLocal",Null) Upvote 0
I see. It is more complicated than I thought: https://www.b4x.com/android/forum/threads/how-to-load-so-libraries-using-inline-java.50827/#content I use the following code to load the library now: B4X: Copy Dim loader As JavaObject loader.InitializeStatic("org.opencv.android.OpenCVLoader") loader.RunMethod("initLocal",Null)