1

我正在按照教程尝试在这里找到的 opencv4android 提供了几个示例。获得 OpenCV-2.4.3.2-android-sdk 并在我的设备上安装管理器后,我在 eclipse 中导入了示例文件,它们都编译成功。但是,我尝试的任何示例都会立即在我的设备上崩溃。例如,如果我运行“15 谜题”示例,我会得到以下错误日志

"01-27 23:11:50.523: E/AndroidRuntime(21568): FATAL EXCEPTION: main
01-27 23:11:50.523: E/AndroidRuntime(21568): java.lang.RuntimeException: Unable to          instantiate activity     ComponentInfo{org.opencv.samples.puzzle15/org.opencv.samples.puzzle15.Puzzle15Activity}:  java.lang.ClassNotFoundException: org.opencv.samples.puzzle15.Puzzle15Activity
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1973)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.os.Looper.loop(Looper.java:137)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread.main(ActivityThread.java:4722)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at java.lang.reflect.Method.invokeNative(Native Method)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at java.lang.reflect.Method.invoke(Method.java:511)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at dalvik.system.NativeStart.main(Native Method)
01-27 23:11:50.523: E/AndroidRuntime(21568): Caused by: java.lang.ClassNotFoundException: org.opencv.samples.puzzle15.Puzzle15Activity
01-27 23:11:50.523: E/AndroidRuntime(21568):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-27 23:11:50.523: E/AndroidRuntime(21568):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964)
01-27 23:11:50.523: E/AndroidRuntime(21568):    ... 11 more"

我不确定我做错了什么,因为这在我尝试的任何 opencv 示例中都是一致的。在此先感谢您的帮助

4

1 回答 1

1

如果其他人遇到类似的问题,我的解决方案只是针对 java 6 而不是 java 7 进行编译。在我写这篇文章时,针对 java 7 的编译不适用于 opencv4android。

于 2013-01-30T00:40:29.063 回答