0

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?

mithil1501
  • 506
  • 9
  • 20

1 Answers1

0

try to add dependency:

implementation 'com.android.support:support-v4:28.0.0'

As Log shows, classes.jar module has duplicated classes, please try removing conflicted files from the gradle too

android{
...
  configurations {
     all*.exclude group:'android.support.v4.app' module: ‘classes.jar’
     all*.exclude group:'android.support.v4.accessibilityservice' module: ‘classes.jar’
  }
}
  • could you plz tell us the group and module info of 'HERE-sdk.aar' as this I already tried using package info in group part but didn't work. – mithil1501 Feb 12 '20 at 07:11
  • also, Is there any new sdk for Directions widget Button which is compatible with latest HERE-sdk? – mithil1501 Feb 12 '20 at 07:18
  • please refer this doc : https://developer.here.com/documentation/android-starter/dev_guide/topics/app-run-simple.html –  Feb 12 '20 at 07:41
  • please share the version of SDK ? –  Feb 12 '20 at 07:42
  • common.aar, directions-api.aar, directions-widgets.aar, here-deeplink-1.1.0.aar, here-units.aar, ui-toolkit.aar these are the libs which we have used for the "com.here.es.directions.button.DirectionsWidgetButton" and recently we have added HERE_Android_SDK_Premium_v3.14.2_192 for the Maps implementation. – mithil1501 Feb 12 '20 at 10:55