Ask Your Question
1

No implementation found for long DetectionBasedTracker.nativeCreateObject(java.lang.String, int)

asked 2014-09-17 11:52:08 -0600

hendrik gravatar image

updated 2014-09-17 12:23:48 -0600

Hi,

I'm trying to compile and run the face detection demo from openCV-2.4.9-android-sdk. I have already configured the Appliation.mk and the Android.mk. As I have no idea how these files work I did trial and error and came out with the following:

Android.mk:

LOCAL_PATH := $(call my-dir)   
include $(CLEAR_VARS)
#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
OPENCV_LIB_TYPE:=SHARED
include D:/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl
LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-14

this builds the natives and copies it to the app dir. So far everything works fine. Problem is at runtime:

mNativeDetector = new DetectionBasedTracker(mCascadeFile.getAbsolutePath(), 0);

results in

java.lang.UnsatisfiedLinkError: No implementation found for long de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.nativeCreateObject(java.lang.String, int) (tried Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject and Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject__Ljava_lang_String_2I) at de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.nativeCreateObject(Native Method) at de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.<init>(DetectionBasedTracker.java:9) at de.hendrik.test.opencv_facerecognition.MyActivity$1.onManagerConnected(MyActivity.java:90) at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:318) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1202) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1219) at android.os.Handler.handleCallback(Handler.java:738) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5070) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)

I am using Android Studio (latest beta) and a Nexus 5 with Developer Preview (Android-L). Any ideas are appreciated.

thanks in advance Hendrik

edit: I found a mismatch between

DetectionBasedTracker_jni.cpp

JNIEXPORT jlong JNICALL Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject
  (JNIEnv *, jclass, jstring, jint);

and DetectionBasedTracker.java

private static native long nativeCreateObject(String cascadeName, int minFaceSize);

as you can see the first two parameters are missing but i have no idea what to provide.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-04-07 12:17:05 -0600

I know this question is super old but I wanted to share my notes in case somebody else faces the same issue.

In my case the issue was that I had forgotten to update my header file with the correct function signature after making changes in the cpp file.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-09-17 11:52:08 -0600

Seen: 2,981 times

Last updated: Sep 17 '14