package not found - issue building libdetection_based_tracker.so

asked 2015-05-08 14:42:13 -0600

zehemz gravatar image

updated 2015-05-09 01:58:49 -0600

berak gravatar image

Hi there! I'm trying to run face-detection sample over Android Studio (on windows...) I'm testing the app in a MotoG (ARM) and the following Application and Android mk.

in my project I have: src\main\libs\armeabi-v7a\ but just the file libdetection_based_tracker.so

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
#OPENCV_LIB_TYPE:=SHARED
include C:\Users\lbais\Documents\OpenCV-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)

Compile output:

C:\Users\lbais\Documents\face-detection\openCVSamplefacedetection\src\main\jni>n
dk-build
Android NDK: WARNING:C:/Users/lbais/Documents/face-detection/openCVSamplefacedet
ection/src/main//jni/Android.mk:detection_based_tracker: non-system libraries in
 linker flags: -lopencv_java
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_S
TATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependenc
ies of the
Android NDK:     current module
[armeabi-v7a] Compile++ thumb: detection_based_tracker <= DetectionBasedTracker_
jni.cpp
[armeabi-v7a] SharedLibrary  : libdetection_based_tracker.so
C:/Users/lbais/AppData/Local/Android/ndk/toolchains/arm-linux-androideabi-4.8/pr
ebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-l
inux-androideabi/bin/ld.exe: warning: hidden symbol '__aeabi_atexit' in C:/Users
/lbais/AppData/Local/Android/ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-
v7a/thumb/libgnustl_static.a(atexit_arm.o) is referenced by DSO C:/Users\lbais\D
ocuments\OpenCV-android-sdk\sdk\native\jni\/../libs/armeabi-v7a/libopencv_java.s
o
[armeabi-v7a] Install        : libdetection_based_tracker.so => libs/armeabi-v7a
/libdetection_based_tracker.so

Error:

05-08 18:03:16.179  21367-21367/org.opencv.samples.facedetect E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: org.opencv.samples.facedetect, PID: 21367
    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.facedetect-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libdetection_based_tracker.so"
            at java.lang.Runtime.loadLibrary(Runtime.java:366)

Full log:

05-08 18:03:16.123  21367-21367/org.opencv.samples.facedetect D/OpenCVManager/Helper﹕ Trying to init OpenCV libs
05-08 18:03:16.123  21367-21367/org.opencv.samples.facedetect D/OpenCVManager/Helper﹕ Trying to load library /data/app/org.opencv.engine3-1/lib/arm/libopencv_java.so
05-08 18:03:16.169  21367-21367/org.opencv.samples.facedetect D/OpenCVManager/Helper﹕ OpenCV libs init was ok!
05-08 18:03:16.169  21367-21367/org.opencv.samples.facedetect D/OpenCVManager/Helper﹕ First attempt to load libs is OK
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ [ 05-08 18:03:16.172 21367:21367 I/OpenCVManager/Helper ]
    General configuration for OpenCV 3.0.0-rc1 =====================================
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ Version control:               3.0.0-rc1
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ [ 05-08 18:03:16.172 21367:21367 I/OpenCVManager/Helper ]
    Platform:
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ Host:                        Darwin 13.2.0 i386
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ Target:                      Linux 1 armv7-a
05-08 18:03:16.172  21367-21367/org.opencv.samples.facedetect I/OpenCVManager/Helper﹕ CMake:                       2.8.12.2
05-08 ...
(more)
edit retag flag offensive close merge delete

Comments

1

It seems that you are using precompiled example from the 3.0-rc1 release. There is an issue about it: http://code.opencv.org/issues/4304 - it does not contain all precompiled libraries, only mips.

The issue is being fixed and updated android pack will be uploaded to the Sourceforge in a day or two.

mshabunin gravatar imagemshabunin ( 2015-05-12 09:33:02 -0600 )edit

Did you fix this, when I download the latest from the bug report, it does not contain libdetection_based_tracker.so in the lib directory

burf2000 gravatar imageburf2000 ( 2015-06-08 10:28:47 -0600 )edit

It is located in example package: open "samples/example-face-detection.apk" -> find "lib/<arch>/libdetection_based_tracker.so"

mshabunin gravatar imagemshabunin ( 2015-06-09 10:57:22 -0600 )edit

The face example just seems impossible to get working, did you get the latest 3.0RC

burf2000 gravatar imageburf2000 ( 2015-06-09 15:23:42 -0600 )edit

Make sure you've installed OpenCV manager from SDK, not from Google Play. I tested face example on two devices and it works well.

mshabunin gravatar imagemshabunin ( 2015-06-11 03:48:26 -0600 )edit