我正在尝试在我的项目中使用javacv库。我在libs文件夹中导入了javacpp.jar和javacv.jar。但是当我尝试根据以下代码将haarcascade_frontalface_alt.xml从raw文件夹加载到CvHaarClassifierCascade时
CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad("android.resource:// com.era.facerecognitionandcropping/raw/haarcascade_frontalface_alt"));
抛出以下异常。
06-12 16:09:08.550: E/AndroidRuntime(24730): FATAL EXCEPTION: main
06-12 16:09:08.550: E/AndroidRuntime(24730): Process: com.era.facerecognitionandcropping, PID: 24730
06-12 16:09:08.550: E/AndroidRuntime(24730): java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_objdetect
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:336)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:315)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacv.cpp.opencv_objdetect$CvHaarClassifierCascade.<clinit>(opencv_objdetect.java:176)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.era.facerecognitionandcropping.MainActivity$4.onClick(MainActivity.java:271)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.view.View.performClick(View.java:4471)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.view.View$PerformClick.run(View.java:18784)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.os.Handler.handleCallback(Handler.java:808)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.os.Handler.dispatchMessage(Handler.java:103)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.os.Looper.loop(Looper.java:193)
06-12 16:09:08.550: E/AndroidRuntime(24730): at android.app.ActivityThread.main(ActivityThread.java:5330)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.reflect.Method.invokeNative(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.reflect.Method.invoke(Method.java:515)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
06-12 16:09:08.550: E/AndroidRuntime(24730): at dalvik.system.NativeStart.main(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_objdetect
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.classForName(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.forName(Class.java:251)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:334)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 14 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_features2d
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:336)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:97)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 17 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_features2d
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.classForName(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.forName(Class.java:251)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:334)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 18 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_highgui
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:336)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacv.cpp.opencv_features2d.<clinit>(opencv_features2d.java:93)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 21 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_highgui
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.classForName(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.forName(Class.java:251)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:334)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 22 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_imgproc
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:336)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 25 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_imgproc
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.classForName(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.forName(Class.java:251)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:334)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 26 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_core
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:336)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 29 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_core
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.classForName(Native Method)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Class.forName(Class.java:251)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:334)
06-12 16:09:08.550: E/AndroidRuntime(24730): ... 30 more
06-12 16:09:08.550: E/AndroidRuntime(24730): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/mnt/asec/com.era.facerecognitionandcropping-2/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.era.facerecognitionandcropping-2/lib, /vendor/lib, /system/lib]]]: findLibrary returned null
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.Runtime.loadLibrary(Runtime.java:365)
06-12 16:09:08.550: E/AndroidRuntime(24730): at java.lang.System.loadLibrary(System.java:606)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:444)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:368)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.javacpp.Loader.load(Loader.java:315)
06-12 16:09:08.550: E/AndroidRuntime(24730): at com.googlecode.jav
如何解决此错误?任何建议都有很大帮助。