I am a beginner Android developer, I am developing an Android application that includes the OpenCV library as below:
My application also needs a library (named LibA) but it also contains Opencv:
When I build an application I got error message
Type org.opencv.android.AsyncServiceHelper$3 is defined multiple times: D:\SourceCode\ABC\openCVLibrary42\build.transforms\096e4eb455c1b3f91f1eb28987c7a730\transformed\release\org\opencv\android\AsyncServiceHelper$3.dex, D:\SourceCode\ABC\app\build\intermediates\external_libs_dex\release\mergeExtDexRelease\classes2.dex
I tried to exclude Opencv in LibA as below but it doesn't work
implementation ('com.ceco.library:library-temp:2.0.5-SNAPSHOT'){
exclude module: 'org.opencv'
}
This is dependencies of LibA
com.ceco.library:library-temp:2.0.5-SNAPSHOT
+--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.50 -> 1.6.0 (*)
+--- com.guide:guidecore:v2.5.3
+--- com.ceco.library:library-card:1.0.7-SNAPSHOT
| +--- com.squareup.okhttp3:okhttp:4.9.0
| | +--- com.squareup.okio:okio:2.8.0 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 -> 1.6.0 (*)
| +--- com.squareup.okio:okio:2.8.0 (*)
| +--- com.github.angads25:filepicker:1.1.1
| +--- net.grandcentrix.tray:tray:0.12.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| \--- androidx.appcompat:appcompat:1.0.0 -> 1.4.1 (*)
\--- androidx.appcompat:appcompat:1.0.0 -> 1.4.1
This is my app/build.gradle dependencies
dependencies {
....
// Others
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(path: ':openCVLibrary42')
//
implementation 'com.ceco.library:library-temp:2.0.5-SNAPSHOT'
}
How can I resolve the above problem?

