# Build opencv sdk for android with only some module

**URL:** <https://forum.opencv.org/t/build-opencv-sdk-for-android-with-only-some-module/5924>\
**Category:** Android/Java\
**Tags:** build\
**Created:** [October 28, 2021, 9:39am UTC](https://forum.opencv.org/t/build-opencv-sdk-for-android-with-only-some-module/5924 "2021-10-28T09:39:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gioipv](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/gioipv/32/3607_2.png) [@gioipv](https://forum.opencv.org/u/gioipv)\
**Post date:** [October 28, 2021, 9:39am UTC](https://forum.opencv.org/t/build-opencv-sdk-for-android-with-only-some-module/5924/1 "2021-10-28T09:39:23Z")

</div>

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.py`in 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
- set DBUILD\_TESTS=OFF ; DINSTALL\_TESTS=OFF ; BUILD\_ANDROID\_EXAMPLES=OFF ; INSTALL\_ANDROID\_EXAMPLES=OFF; no\_samples\_build = False
- I aslo conda deactive before run the script.
