Build opencv4.0.1 & opencv_contrib for Android on macOS

Nhan Cao
3 min readApr 6, 2019

Related-post:

Start

  • Click Configure
  • Point to “/Volumes/Soft/_Program_Files/opencvfull/opencv-4.0.1/platforms/android/android.toolchain.cmake”
  • Check and update CMake program if it can not auto detect. The CMake version need to update respective.
CMAKE_MAKE_PROGRAM = /Users/nhancao/Library/Android/sdk/cmake/3.6.4111459/bin/ninja
  • Add entry
ANDROID_NDK - PATH = /Volumes/Soft/_Program_Files/opencvfull/android-ndk-r16bANDROID_SDK_ROOT - PATH = /Users/nhancao/Library/Android/sdkANDROID_NATIVE_API_LEVEL - STRING = 27
  • Click Configure
  • Update CMAKE_INSTALL_PREFIX = /Volumes/Soft/_Program_Files/opencvfull/opencv-4.0.1/android_build/install
  • Update OPENCV_EXTRA_MODULES_PATH = /Volumes/Soft/_Program_Files/opencvfull/opencv_contrib-4.0.1/modules
  • Uncheck to disable some config below
* Disable BUILD_ANDROID_PROJECTS
* Disable…

--

--