我试图在java中加载opencv库,如
static {
System.loadLibrary("myopencv");
}
在setting.gradle中
include ':libraries:opencvss'
其中“myopencv”是项目中的库名。 这是在android studio中加载库的正确方法吗?
所以我的问题是在运行期间安装apk UnsatisfiedLinkError: 这是我的错误日志:
09-26 15:42:30.513 25824-25824/? E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV
09-26 15:42:30.533 25824-25824/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myeffects, PID: 25824
java.lang.UnsatisfiedLinkError: Couldn't load opencv_java from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/mnt/asec/com.example.myeffects-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.myeffects-1/lib, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:606)
at com.example.myeffects.CartoonifierView.<clinit>(CartoonifierView.java:262)
at com.example.myeffects.CartoonifierApp.onCreate(CartoonifierApp.java:68)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2393)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5295)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)