Adding OpenCV 4 Library To Android Studio

Опубликовано: 28 Февраль 2026
на канале: ElectroCode
8,287
114

In this video, I will add OpenCV 4 library to android studio and run basic code to check if it is working properly.

Process:
1. Download OpenCV 4 latest version.
Link: https://opencv.org/releases/

2. Create a new project in android studio.

3. Extract the zip file.
It will take some time.

4. Import Module.
You have to select SDK for OpenCV 4.
Change the name to OpenCV4.
Press finish.
It will take time to process it.
Now to solve this error remove this line and then sync the project.

5. GO to file/ Project structure/ Dependencies.
Select app.
press on +.
Here select OpenCV4.
Apply

6. Change SDK version.
Sync

7. Last and most important part add jni library.
path: opencv-4.5.3-android-sdk\OpenCV-android-sdk\sdk\native\libs
Copy all files.
Create a jni folder and name it jnilibs.
"jnilibs" should not be changed to other names.
This will create a cpp folder.
Now paste all 4 files in that "jnilibs" folder.
path: OpenCVProject\app\src\main\jnilibs