Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build OpenCV library from source for Android

Hello, I recently jumped on a OpenCV project and am trying to cross-compile OpenCV shared library .so from source for Android on Windows. I set up the environment with various tools. In CMake, I chose the source code location and build directory, and the following options,

ANDROID_ABI=arm64-v8a, ANDROID_NDK, ANDROID_SDK_ROOT, ANDROID_NATIVE_API_LEVEL, BUILD_SHARED_LIB, BUILD_ANDROID, ARM64_V8A, ANDROID_TOOLCHAIN_NAME=aarch64-linux-android-4.9, CMAKE_MAKE_PROGRAM=ndk/16.x.xxxxxxx/prebuilt/windows-x86_64/bin/make.exe

After the Configure and Generate steps, on Windows, in the build directory, the build started with executing in command line ming32-make.exe. I got 14 .so library files with, but the does not contain all modules, with its size being 1.47 MB only. I know there are subject-experts in this forum. Can someone tell why I did not get an opencv library that contains all modules?

The libraries I got are these

The has a size of 2.14MB. I downloaded the OpenCV-android-sdk from, and its size is 27.9MB. Why is my of a so small size?

Thanks Charles