我一直在尝试在 Android 项目上运行 JavaCV 代码。此代码在 Windows 7 上运行时对我有用(使用 Eclipse)。
我搜索了我得到的错误,并尝试按照本论坛答案和其他人的描述设置所有内容,但仍然没有运气。
我用 *.Jar 文件创建了一个 libs 文件夹,并将它们包含在我的构建路径中。我还将 *.so 文件添加到 libs\armeabi 文件夹
我会感谢你在这件事上的及时重播。
以下是所有细节。
库文件夹:
<DIR> .
<DIR> ..
<DIR> armeabi
<DIR> armeabi-v7a
83,949 javacpp.jar
1,239,034 javacv-macosx-x86_64.jar
932,050 javacv-windows-x86.jar
1,211,623 javacv-windows-x86_64.jar
955,900 javacv.jar
'armeabi' folder:
7,306,044 libavcodec.so
40,484 libavdevice.so
578,872 libavfilter.so
1,169,460 libavformat.so
141,516 libavutil.so
394,443 libjniARToolKitPlus.so
418,079 libjniavcodec.so
95,819 libjniavdevice.so
218,655 libjniavfilter.so
225,831 libjniavformat.so
153,427 libjniavutil.so
112,051 libjnicvkernels.so
125,263 libjniopencv_calib3d.so
613,075 libjniopencv_contrib.so
545,215 libjniopencv_core.so
238,119 libjniopencv_features2d.so
101,479 libjniopencv_flann.so
57,979 libjniopencv_highgui.so
249,339 libjniopencv_imgproc.so
1,017,267 libjniopencv_legacy.so
663,071 libjniopencv_ml.so
86,719 libjniopencv_nonfree.so
241,027 libjniopencv_objdetect.so
39,579 libjniopencv_photo.so
680,443 libjniopencv_stitching.so
110,255 libjniopencv_video.so
167,499 libjniopencv_videostab.so
87,503 libjnipostproc.so
91,627 libjniswresample.so
108,119 libjniswscale.so
957,220 libopencv_calib3d.so
1,063,888 libopencv_contrib.so
2,349,724 libopencv_core.so
880,336 libopencv_features2d.so
706,228 libopencv_flann.so
1,146,792 libopencv_highgui.so
1,990,768 libopencv_imgproc.so
1,415,324 libopencv_legacy.so
880,584 libopencv_ml.so
458,764 libopencv_nonfree.so
422,580 libopencv_objdetect.so
68,080 libopencv_photo.so
769,728 libopencv_stitching.so
902,676 libopencv_ts.so
203,904 libopencv_video.so
560,688 libopencv_videostab.so
89,080 libpostproc.so
65,572 libswresample.so
204,020 libswscale.so
The error log file:
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.BufferedImage', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 942 (Ljava/awt/image/BufferedImage;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x000e
08-16 15:12:56.030: I/dalvikvm(3801): Could not find method java.awt.color.ColorSpace.getInstance, referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve static method 13250: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x71 at 0x0033
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x0052
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.BufferedImage', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve check-cast 942 (Ljava/awt/image/BufferedImage;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x1f at 0x0094
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.BufferedImage', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve check-cast 942 (Ljava/awt/image/BufferedImage;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x1f at 0x00b7
08-16 15:12:56.030: I/dalvikvm(3801): Could not find method java.awt.color.ColorSpace.getInstance, referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve static method 13250: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x71 at 0x00c6
08-16 15:12:56.030: I/dalvikvm(3801): Could not find method java.awt.color.ColorSpace.getInstance, referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve static method 13250: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x71 at 0x00de
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x00fc
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x012e
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x0160
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x0191
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.ComponentColorModel', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 944 (Ljava/awt/image/ComponentColorModel;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x01c2
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.BufferedImage', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve check-cast 942 (Ljava/awt/image/BufferedImage;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x1f at 0x01f9
08-16 15:12:56.030: E/dalvikvm(3801): Could not find class 'java.awt.image.BufferedImage', referenced from method com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage
08-16 15:12:56.030: W/dalvikvm(3801): VFY: unable to resolve new-instance 942 (Ljava/awt/image/BufferedImage;) in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: replacing opcode 0x22 at 0x0077
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0010-001e in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0036-0036 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0054-0076 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0079-0083 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0096-00b2 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x00b9-00b9 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x00c9-00c9 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x00e1-00e1 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x00fe-0124 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0130-0156 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0162-0188 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x0193-01b9 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x01c4-01ea in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.030: D/dalvikvm(3801): VFY: dead code 0x01fb-0205 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage (DZLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
08-16 15:12:56.035: I/dalvikvm(3801): DexOpt: unable to optimize instance field ref 0x0ef1 at 0xa2 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.copyFrom
08-16 15:12:56.035: I/dalvikvm(3801): DexOpt: unable to optimize instance field ref 0x0ef1 at 0x88 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.copyTo
08-16 15:12:56.045: I/dalvikvm(3801): Total arena pages for JIT: 11
08-16 15:12:56.105: D/dalvikvm(3801): GC_CONCURRENT freed 243K, 48% free 2948K/5639K, external 8639K/9382K, paused 1ms+1ms
08-16 15:12:56.185: D/dalvikvm(3801): Trying to load lib /data/data/com.zdm.picabus/lib/libopencv_core.so 0x4051c668
08-16 15:12:56.190: D/dalvikvm(3801): Added shared lib /data/data/com.zdm.picabus/lib/libopencv_core.so 0x4051c668
08-16 15:12:56.190: D/dalvikvm(3801): No JNI_OnLoad found in /data/data/com.zdm.picabus/lib/libopencv_core.so 0x4051c668, skipping init
08-16 15:12:56.190: W/dalvikvm(3801): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/googlecode/javacv/cpp/opencv_core;
08-16 15:12:56.190: W/dalvikvm(3801): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/googlecode/javacv/cpp/opencv_core$CvArr;
08-16 15:12:56.190: D/AndroidRuntime(3801): Shutting down VM
08-16 15:12:56.190: W/dalvikvm(3801): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
08-16 15:12:56.195: E/AndroidRuntime(3801): FATAL EXCEPTION: main
08-16 15:12:56.195: E/AndroidRuntime(3801): java.lang.ExceptionInInitializerError
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.zdm.picabus.imageprocessing.costumizeImg.processImage(costumizeImg.java:22)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.zdm.picabus.cameraservices.CameraActivity.onActivityResult(CameraActivity.java:33)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.Activity.dispatchActivityResult(Activity.java:3934)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2111)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1672)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2836)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.access$1600(ActivityThread.java:117)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.os.Handler.dispatchMessage(Handler.java:99)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.os.Looper.loop(Looper.java:130)
08-16 15:12:56.195: E/AndroidRuntime(3801): at android.app.ActivityThread.main(ActivityThread.java:3691)
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.reflect.Method.invokeNative(Native Method)
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.reflect.Method.invoke(Method.java:507)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
08-16 15:12:56.195: E/AndroidRuntime(3801): at dalvik.system.NativeStart.main(Native Method)
08-16 15:12:56.195: E/AndroidRuntime(3801): Caused by: java.lang.ExceptionInInitializerError
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.Class.classForName(Native Method)
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.Class.forName(Class.java:234)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacpp.Loader.load(Loader.java:314)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacpp.Loader.load(Loader.java:294)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:156)
08-16 15:12:56.195: E/AndroidRuntime(3801): ... 18 more
08-16 15:12:56.195: E/AndroidRuntime(3801): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core: findLibrary returned null
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.Runtime.loadLibrary(Runtime.java:429)
08-16 15:12:56.195: E/AndroidRuntime(3801): at java.lang.System.loadLibrary(System.java:554)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacpp.Loader.load(Loader.java:367)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacpp.Loader.load(Loader.java:294)
08-16 15:12:56.195: E/AndroidRuntime(3801): at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:129)
08-16 15:12:56.195: E/AndroidRuntime(3801): ... 23 more"