Ask Your Question

getting unsatisfiedLinkerror while trying to re-use opencv-facedection sample

asked 2013-10-27 14:14:47 -0500

bunta gravatar image

updated 2013-10-27 14:42:50 -0500

I am trying to use openCV in android. So I am following the link -

My basic intenstion is to create my own Android project and copying all the OpenCV Sample - face-detection sample source code to the new project and test the same to verify the android project setup.

I created an android project XYZ and then added the openCV library, then copied the jni directory from OpenCV Sample - face-detection to XYZ project and then trigger

which generate a armeabi-v7a directory inside lib folder. Then I copied all the sourcecode from sample to xyz and run and then I found the following error-

java.lang.UnsatisfiedLinkError: Native method not found:

com.example.emotiondetector.DetectionBasedTracker.nativeCreateObject:(Ljava/lang/String;I) at com.example.emotiondetector.DetectionBasedTracker.nativeCreateObject(Native Method)

at com.example.emotiondetector.DetectionBasedTracker.<init> com.example.emotiondetector.FdView.<init>(

Means jni didnt work properly. Can anyone suggest where did I miss the core thing ?

Following warning came while generating jni-

C:\android-ndk-r9-windows-x86_64\android-ndk-r9\ndk-build.cmd Android NDK: WARNING:jni/ non-system libraries in linker flags: -lopencv_java Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK:
current module Install : => libs/armeabi-v7a/

AFter quick search I found its a popular problem-

"java.lang.UnsatisfiedLinkError: Native method not found:;I)J", ->

But couldnt get any solution ...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-08-24 23:24:23 -0500

pprov gravatar image

updated 2014-08-24 23:26:44 -0500

If you copied the .h and .cpp from the face-detection sample to your own project, be sure to update the function signatures to reflect your own Java package rather than the OpenCV one. Look for something like this:


and change it to:


where com_your_app is your android project's Java package name

This needs to be done for all the functions in the .h and .cpp files. (Alternatively, look into the use of javah)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-10-27 14:14:47 -0500

Seen: 1,721 times

Last updated: Aug 24 '14