Android, Generate Jni Header Files With Javah , Show Error That Can't Find Org.opencv.core.mat
Solution 1:
This is what I did:
1.Open Command line, type to the (project)/bin/classes: 2.type: javah -classpath (opencv4android sdk path)/java/bin/classes:(your project location)/bin/classes -jni (your java class file that contains the native library interfaces)
In my project. I did:
javah -classpath /home/zijun/Dev/adt/OpencvAndroid/sdk/java/bin/classes:/home/zijun/workspace/LocTM/bin/classes -jni com.brainport.loctm.TMatching
That works on Linux Ubuntu 12.04.02 64bit OS
Solution 2:
I encountered the same problem too,it cost me half day.I just copy DetectionBasedTracker.java to my poject.I use Android Studio.When I use ExternalTools>javah to generate .h files,the console print cant find org.opencv.core.Mat.copying mat.java & matofRect.java to the directory DetectionBasedTracker.java exists just cause more java class cant be find.finally,I find this problem was caused by the import * clause in java file.and we seldom use java class in native method we defined.so I cut these java method and got this:
package cn.ntu.tonguefur.nativemethod;
publicclassDetectionBasedTracker{
privatestaticnativelongnativeCreateObject(String cascadeName,int minFaceSize);
//Other native methodsprivatestaticnativevoidnativeDetect(long thiz,long inputImage,long faces);
}
Now you can freely use javah command to generate .h file.After that,add java methods and import packages you need.
Post a Comment for "Android, Generate Jni Header Files With Javah , Show Error That Can't Find Org.opencv.core.mat"