错误:找不到类org.opencv.core.Mat

时间:2016-09-01 02:51:34

标签: android opencv java-native-interface javah

当我使用' javah'生成带有JNI的头文件时它显示

Error: Class org.opencv.core.Mat could not be found.

系统:Mac OSX

使用:Android Studio和opencv 3.1 for android

命令行:

javah -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar:. com.lumenghz.test.OpencvHelper

谁能帮帮我?

修改-1 我也试过

javah -d ~/Documents/androidworkspace/RumenTest/test/src/main/jni -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar:. com.lumenghz.test.OpencvHelper

但仍然有同样的错误:

Error: Class org.opencv.core.Mat could not be found.

2 个答案:

答案 0 :(得分:1)

你在这里提供了错误的课程路径:

  

com.lumenghz.test.OpencvHelper

像这样给出完整的类路径:

  

〜/文档/ androidworkspace / RumenTest / openCVLibrary310 /建造/中间体/类/调试:. com.lumenghz.test.OpencvHelper

  javah -d (JNI Folder Location) -classpath (JAR Locaion);(class Path)

根据您的路径示例 -

 javah -d ~/Documents/androidworkspace/RumenTest/test/src/main/jni -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar;~/Documents/androidworkspace/RumenTest/openCVLibrary310/build/intermediates/classes/debug: com.lumenghz.test.OpencvHelper

答案 1 :(得分:0)

<强>解决

我应该声明已经构建的opencv-sdk-android的类路径。

所以commandLine应该是这样的:

javah -classpath ~/Documents/androidworkspace/RumenTest/openCVLibrary310/build/intermediates/classes/debug:. com.lumenghz.test.OpencvHelper