I tried many tutorials and blogs for Setting up OpenCV Android Library on Android Studio some of them are here
A Beginner’s Guide to Setting up OpenCV Android Library on Android Studio
Add OpenCV library into Android Studio
OpenCV in Android Studio
but i am unable to configure it according to above solutions
at start when i try to import module from /OpenCV-android-sdk/sdk/java
android studio not showing module name edit box and hence i have to add "java" as a OpenCV
module name
OK after importing module with the name of java we have to add dependencies but in add module dependencies not showing any module name java or anything
Guys anyone know how can i resolve this issue or any proper steps for OpenCV
configuration in Android studio
I am using
Android Studio -4.0
opencv-4.3.0-android-sdk
After successfully creating an Android project, it is time to import the OpenCV module into your Android project. Click on File -> New -> Import Module… It should bring up a popup like the image below where you can select the path to the module you want to import.
This is a simplified version of this(1) SO answer. Download latest OpenCV sdk for Android from OpenCV.org and decompress the zip file. Import OpenCV to Android Studio, From File -> New -> Import Module, choose sdk/java folder in the unzipped opencv archive. Update build.
To see the Android.mk file, go to the "Project Files" view of Android Studio. The default view is "Android". You need to access Project Files from the drop-down menu. Edit the path in the screenshot below to match the path of your local OpenCV source code (which is part of this repo).
You'll see a couple of sample applications, which you can use as a basis for your own developments. “Android development with OpenCV” shows you how to add OpenCV functionality into your Android application. For those who want to reuse their C++ code, we've created a special section: “Native/C++”.
First Screenshot: Android Studio may have removed that option in new version.
Second Screenshot: You can solve issue by editing build.gradle of Opencv as below:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
//applicationId "org.opencv"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
Change apply plugin: 'com.android.application' to apply plugin: 'com.android.library'
and comment out the following line :
applicationId "org.opencv"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With