There is this situation where I am trying to use MLKit inside Unity. Naturally I make an Android plugin. Here are the Gradle dependencies:
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.camera:camera-camera2:1.1.0-alpha02"
implementation "com.google.mlkit:pose-detection:17.0.1-beta3"
}```
Then I compile the .aar using
```task copyPlugin(type: Copy) {
dependsOn assemble
from ('build/outputs/aar')
into ('../../../Assets/Plugins/Android')
include (project.name + '-release.aar')
}```
What happens next is that Unity is not able to access **androidx.camera:camera-camera2:1.1.0-alpha02** or **com.google.mlkitpose-detection:17.0.1-beta3**. Because of this, I have to use **unity-jar-resolver** to download the dependencies so that Unity will link them with the resulting app. I expected everything will work but now the dependencies seem to collide. Can you give me an insight into this? Here is the Unity build error:
```* What went wrong:
Execution failed for task ':launcher:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class androidx.camera.camera2.Camera2Config found in modules PoseDetector-release-runtime.jar (:PoseDetector-release:) and androidx.camera.camera-camera2-1.1.0-alpha02-runtime.jar (:androidx.camera.camera-camera2-1.1.0-alpha02:)
Duplicate class androidx.camera.camera2.Camera2Config$DefaultProvider found in modules PoseDetector-release-runtime.jar (:PoseDetector-release:) and androidx.camera.camera-camera2-1.1.0-alpha02-runtime.jar (:androidx.camera.camera-camera2-1.1.0-alpha02:)
Duplicate class androidx.camera.camera2.impl.Camera2CameraCaptureResultConverter found in modules PoseDetector-release-runtime.jar (:PoseDetector-release:) and androidx.camera.camera-camera2-1.1.0-alpha02-runtime.jar (:androidx.camera.camera-camera2-1.1.0-alpha02:)```