I am creating an android app which has an old dependency of 'directions-api.aar'(Here-Maps widget library) and now I need to add 'HERE-sdk.aar' for Map's implementation.
This is leading to an issue there are some classes which are common in both the 'aar' files. Thus android studio throws below exception:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
1 exception was raised by workers: java.lang.RuntimeException:
Duplicate class com.here.android.mpa.common.CopyrightLogoPosition found in modules HERE-sdk.jar (:directions-api:) and classes.jar (HERE-sdk.aar)
Duplicate class com.here.android.mpa.common.GeoBoundingBox found in modules HERE-sdk.jar (:directions-api:) and classes.jar (HERE-sdk.aar)
Duplicate class com.here.android.mpa.common.GeoCoordinate found in modules HERE-sdk.jar (:directions-api:) and classes.jar (HERE-sdk.aar)
Duplicate class com.here.android.mpa.common.GeoPolygon found in modules HERE-sdk.jar (:directions-api:) and classes.jar (HERE-sdk.aar)
...
I tried :
'exclude group: ‘com.here.android.mpa’, module: ‘HERE-sdk’'
,
packagingOptions { pickFirst 'com/here/android/mpa/common/*'}
and many more soutions but none of this worked.
Does any body know how to exclude the duplicate classes/dependencies from the conflicting aar files?