Issue in Adding Module dependency for OpenCv

不问归期 提交于 2019-12-08 00:57:44

问题


I am trying to add Module Dependency for Open Cv.

For that I have downloaded latet OpenCv library from below link : https://sourceforge.net/projects/opencvlibrary/files/opencv-android/3.4.3/

Then, In Android Studio, I have done as below :

File > New > Import Module

In this way I have imported a module/directory for OpenCv.

Now, I have to add Module Dependency for added module. To do so I am trying to do as below :

File > Project Structure > Dependencies > + > Module Dependency

But, It showing me : Select at least one module

Reference Images are as below :

What might be the issue ?


回答1:


It's Solved 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'
        }
    }
}

Changed apply plugin: 'com.android.library' from apply plugin: 'com.android.application'

and

Commented below line :

applicationId "org.opencv"




回答2:


The issue can be resolved, If you are not able to add the dependency from the project structure while you can directly write it in the build.gradle of app.

Note: Do not rename the opencv folder while you were adding it as a module in your project.

In build.gradle of app write:

dependencies{
implementation project (':openCVLibrary347') // The name of my opencv module folder 
}


来源:https://stackoverflow.com/questions/57050690/issue-in-adding-module-dependency-for-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!