Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing no OpenCV module in dependancies in Android Studio

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

enter image description here

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

enter image description here

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

like image 785
Mayur Satav Avatar asked Jul 06 '20 06:07

Mayur Satav


People also ask

Can I import OpenCV to Android Studio?

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.

Can we use OpenCV for Android app?

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.

How use OpenCV image processing in Android?

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).

Does OpenCV work on mobile?

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++”.


1 Answers

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"

like image 84
The Jimit Avatar answered Oct 19 '22 03:10

The Jimit