Build OpenCV library from source for Android [closed]

asked 2020-03-23 16:11:04 -0500

CharlesC gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by CharlesC
close date 2020-03-26 10:45:51.322323


cmake -DBUILD_SHARED_LIBS=OFF should get you a "fat" opencv_java so, which contains all others

berak gravatar imageberak ( 2020-03-24 04:50:07 -0500 )edit

I found that setting BUILD_opencv_world created the library expected.

CharlesC gravatar imageCharlesC ( 2020-03-26 10:45:40 -0500 )edit