Build opencv sdk for android with only some module

Hi, I am a newbie and in this topic i just want to share the way i did. about building a opencv sdk for android on ubuntu
I had to spend some days building opencv sdk for android haha, . I have to build my opencv sdk Because in my application I only use some basic modules (are core, and imgproc), I dont want to my app is large in size
I also have to build with java module, and imgcodecs module, because imgcodecs is also base module. and java because I want to build lib with share lib ==> sdk will be have: core,imgproc,java,imgcodecs
I started building with cmake, but my desktop has multiple env’s, so it’s very confusing, with many bug
finally, I use python script platform/android/build_sdk.pyin opencv source code for build. with using SDK and NDK tool from SDK manager in android studio. The argument:

  • work_dir is path to output path
  • opencv_dir is path to source code opencv
  • ndk_path is (SDK path)+/ndk/18.1.5063045 # this is my ndk version i choose
  • sdk_path is (SDK path) # ex: /home/user_name/Android/Sdk
  • modules_list is “core,imgproc,imgcodecs,java”
  • disable kotlin extensions
  • I aslo conda deactive before run the script.
1 Like