java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList .....]无法找到" libdetection_based_tracker.so"

时间:2017-03-10 23:20:03

标签: android android-ndk

当我尝试运行OpenCV样本进行面部检测时,我收到此错误。我已经设置了Android SDK路径和NDK路径。 android.mk文件和Application.mk文件也设置好了。我不明白为什么我会收到这个错误。请帮忙。

Android.mk

    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    #OPENCV_CAMERA_MODULES:=off
    #OPENCV_INSTALL_MODULES:=off
    #OPENCV_LIB_TYPE:=SHARED
    ifdef OPENCV_ANDROID_SDK
     ifneq ("","$(wildcard $(OPENCV_ANDROID_SDK)/OpenCV.mk)")
      include ${OPENCV_ANDROID_SDK}/OpenCV.mk
     else
      include ${OPENCV_ANDROID_SDK}/sdk/native/jni/OpenCV.mk
  endif
  else
  include C:/Users/m/Downloads/opencv-3.2.0-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
endif

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

include $(BUILD_SHARED_LIBRARY)

Application.mk

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

Local.properties

ndk.dir=C\:\\Users\\m\\Documents\\android-ndk-r13b-windows-x86_64\\android-ndk-r13b
sdk.dir=C\:\\Users\\m\\AppData\\Local\\Android\\sdk1

Project structure

1 个答案:

答案 0 :(得分:4)

确保openCVSamplefacedetection build.gradle文件中存在此块:

externalNativeBuild {
    ndkBuild {
         path 'src/main/jni/Android.mk'
    }
}

此外,请确保将Android NDK的PATH导出到您的环境变量。