【问题标题】:Building Library with OpenCV for android fails on "not building target XXX because there was no build command for it"使用 OpenCV for android 构建库在“未构建目标 XXX 因为没有构建命令”时失败
【发布时间】:2017-04-06 06:12:54
【问题描述】:

我有一个使用 cmake 在 mac 上编译并且已经运行的工作 c++ 库。我现在正在尝试使用 Android Studio 和 gradle 为 Android 编译它。
当我尝试使用 Android Studio 编译它时,我收到了一个神秘的链接器错误,所以我尝试使用 gradle 包装器在命令行中编译它,然后出现以下错误:

externalNativeBuildRelease: not building target opencv_calib3d because there was no build command for it
externalNativeBuildRelease: not building target opencv_core because there was no build command for it
externalNativeBuildRelease: not building target opencv_features2d because there was no build command for it
externalNativeBuildRelease: not building target opencv_flann because there was no build command for it
externalNativeBuildRelease: not building target opencv_highgui because there was no build command for it
externalNativeBuildRelease: not building target opencv_imgcodecs because there was no build command for it
externalNativeBuildRelease: not building target opencv_imgproc because there was no build command for it
externalNativeBuildRelease: not building target opencv_ml because there was no build command for it
externalNativeBuildRelease: not building target opencv_objdetect because there was no build command for it
externalNativeBuildRelease: not building target opencv_photo because there was no build command for it
externalNativeBuildRelease: not building target opencv_shape because there was no build command for it
externalNativeBuildRelease: not building target opencv_stitching because there was no build command for it
externalNativeBuildRelease: not building target opencv_superres because there was no build command for it
externalNativeBuildRelease: not building target opencv_video because there was no build command for it
externalNativeBuildRelease: not building target opencv_videoio because there was no build command for it
externalNativeBuildRelease: not building target opencv_videostab because there was no build command for it 
...  

我找不到这个问题的解释。
我的 CMakelists.txt 包括以下行:

set (OpenCV_DIR /usr/local/Cellar/opencv3/HEAD-876c2c0_4/share/OpenCV)
set (CMAKE_MODULE_PATH /usr/local/Cellar/opencv3/HEAD-876c2c0_4/share/OpenCV)
find_package(OpenCV REQUIRED)

它似乎找到了它,但无法构建它。如果有人知道如何解决这个问题,我将不胜感激。

【问题讨论】:

    标签: android c++ opencv gradle android-ndk


    【解决方案1】:

    我找到了答案 我正在使用为 macos 编译的 opencv 二进制文件 我从这里下载了 android sdk https://sourceforge.net/projects/opencvlibrary/files/opencv-android/

    它似乎有效

    【讨论】:

      猜你喜欢
      • 2018-10-30
      • 1970-01-01
      • 2018-03-11
      • 2018-02-18
      • 2019-04-21
      • 1970-01-01
      • 1970-01-01
      • 2019-02-24
      • 1970-01-01
      相关资源
      最近更新 更多