使用OpenCV for android构建库失败了“没有构建目标XXX,因为它没有构建命令”

时间:2017-04-06 06:12:54

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

我有一个工作的c ++库,使用cmake在mac上编译并且已经运行。我现在正尝试使用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)

它似乎找到它但无法构建它。如果有人知道如何解决这个问题我会非常感激。

1 个答案:

答案 0 :(得分:0)

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

似乎有效