Qt平台下OpenCV for Android库的顺序

Android平台下的OpenCV库可在OpenCV的官网上下载到,但是不要以为编译好Android静态链接库就万事大吉了,其实在你的pro文件下需要引入库文件。库文件的顺序不对会崩各种错误,为了解决这个问题,你需要对lib排序,顺序可如下文所示
android{
#指定INCLUDEPATH和
 
  
ANDROID_OPENCV = D:/Programs/OpenCV-3.1.0-android-sdk/OpenCV-android-sdk/sdk/native
INCLUDEPATH += $$ANDROID_OPENCV/jni/include/opencv \
$$ANDROID_OPENCV/jni/include/opencv2 \
$$ANDROID_OPENCV/jni/include

 
  
ANDROID_OPENCV = D:/Programs/OpenCV-3.1.0-android-sdk/OpenCV-android-sdk/sdk/native
#ANDROID_OPENCV = D:/Programs/OpenCV-2.4.9-android-sdk/sdk/native
INCLUDEPATH += $$ANDROID_OPENCV/jni/include/opencv \
$$ANDROID_OPENCV/jni/include/opencv2 \
$$ANDROID_OPENCV/jni/include
 
  
 
  
LIBS += \
        -L"$$ANDROID_OPENCV/3rdparty/libs/arm64-v8a"\
        -L"$$ANDROID_OPENCV/libs/arm64-v8a"\
        -llibtiff\
        -llibjpeg\
        -llibjasper\
        -llibpng\
        -lIlmImf\
        -ltbb\
        -lopencv_flann\
        -lopencv_imgcodecs\
        -lopencv_imgproc\
        -lopencv_core\
        -lopencv_highgui\
        -lopencv_features2d\
        -lopencv_calib3d\
        -lopencv_ml\
        -lopencv_objdetect\
        -lopencv_video\
        -lopencv_photo\
        -lopencv_java\
        -lopencv_stitching\
        -lopencv_superres\
        -lopencv_ts\
        -lopencv_videostab
 
  
ANDROID_PACKAGE_SOURCE_DIR=$$_PRO_FILE_PWD_/android
 
  
contains(ANDROID_TARGET_ARCH,arm64-v8a) {
    ANDROID_EXTRA_LIBS += \
        $$quote($$ANDROID_OPENCV/libs/arm64-v8a/libopencv_java3.so)


你可能感兴趣的:(Qt交叉编译环境)