mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
478 stars 134 forks source link

Issue duplicate class okhttp #2485

Closed longquangpham90 closed 1 month ago

longquangpham90 commented 2 months ago

Environment

implementation ('com.mapbox.mapboxsdk:mapbox-sdk-services:7.2.0') implementation ('com.mapbox.maps:android:v11.3.0') implementation ('com.mapbox.navigation:android:2.20.2') implementation ('com.mapbox.search:mapbox-search-android:2.4.0')

implementation('com.squareup.okhttp3:okhttp:4.12.0') implementation('com.squareup.okhttp3:logging-interceptor:4.12.0')

Observed behavior and steps to reproduce

Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$HttpServiceOfflineSwitchObserver found in modules common-24.6.0.aar -> jetified-common-24.6.0-runtime (com.mapbox.common:common:24.6.0) and okhttp-23.10.1.aar -> jetified-okhttp-23.10.1-runtime (com.mapbox.common:okhttp:23.10.1)

Expected behavior

I want update version Mapbox SDK support for android 35. It crash when I build for android 35, but I have a issue duplicate class with okhttp library

Notes / preliminary analysis

Additional links and references

flasher297 commented 1 month ago

@longquangpham90 it seems that you are trying to use incompatible versions of libraries. In our changelog, I see that v24.0.0 of com.mapbox.common:common

  • Removed com.mapbox.common:okhttp artifact. It is now part of com.mapbox.common:common

In your dependencies, two versions of the common library provide this dependency in different ways: the old one 23.10.1, and the new one 24.6.0. You need to level these dependencies or try to exclude okhttp dependency: { exclude("com.mapbox.common:okhttp", "okhttp") }

longquangpham90 commented 1 month ago

Thanks! I tried. and It's that good idea. It work with android 14

configurations { all { exclude group: 'com.mapbox.common', module: 'okhttp' } }