- Clone the Project
- Download Open4Android 3.4.3 from this Link
- Unzip the Opencv4Android SDK
- Open the Project files from Android Studio
-
- After successfully opening on Android project, Click on the File-> New-> Import Module and
- Browse to the folder where you extracted the OpenCV Android library zip file contents.
- Select the
javafolder inside of thesdkfolder
-
- Click on Next to go to the next screen.
- On the next screen (the image below) you should leave the default options checked and click on Finish to complete the module import.
- You should get a Gradle build error after you finish importing the OpenCV library. This happens because the library is using an old Android SDK that you probably don’t have installed yet.
- To fix this open the
build.gradlefile foropencv4androidand removecompileSdkVersionandtargetSdkVersion - After changing the version you should click on the sync button so that Gradle can sync the project.
- To fix this open the
- Add the OpenCV Dependency
- click on File -> Project Structure.
- click on the Dependencies tab.
- Under the App module click the
+in the Declared Dependencies Section - Click on the Module dependency and add
Opencv4Android
- On the
OpenCv4Android SDKCopy thesdk/native/libsfolder into the app module main folder (UsuallyProjectName/app/src/main) and rename the folder asjniLibs. - Your project is ready and Must
SyncandBuildproperly