问题
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