Duplicate class on build
Environment
- Android OS version: 13
- Devices affected: Google Pixel 7
- Maps SDK Version: 11.0.0
Observed behavior and steps to reproduce
Duplicate class com.mapbox.common.module.okhttp.CallbackWrapper found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.CallbackWrapper$RequestCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.HttpCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.IdGenerator found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.LazyClient found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$1 found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$HttpServiceGetLifecycleStateCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$HttpServiceLifecycleObserver found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$HttpServiceOfflineSwitchObserver found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$QueuedRequest found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$1 found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$DummyEventListener found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$NetworkUsageMetricCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Duplicate class com.mapbox.module.Mapbox_HttpClientModuleConfiguration found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.8.4-runtime (com.mapbox.common:okhttp:23.8.4)
Go to the documentation to learn how to Fix dependency resolution errors.
This is my build.gradle:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'dagger.hilt.android.plugin'
id("com.apollographql.apollo").version("2.5.14")
id 'kotlin-kapt'
}
android {
namespace 'com.example.wheeler'
compileSdk 34
defaultConfig {
applicationId "com.example.wheeler"
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
buildConfigField('String', 'BASE_URL_APP', "\"${BASE_URL_APP}\"")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
buildFeatures {
viewBinding true
buildConfig true
}
}
dependencies {
//framework
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
//dependency injection
implementation 'com.google.dagger:hilt-android:2.49'
kapt 'com.google.dagger:hilt-compiler:2.49'
//coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
//activity
implementation 'androidx.activity:activity-ktx:1.8.1'
//fragment
implementation 'androidx.fragment:fragment-ktx:1.6.2'
//responsive sizes
implementation 'com.intuit.sdp:sdp-android:1.1.0'
implementation 'com.intuit.ssp:ssp-android:1.1.0'
//lifecycle
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
//recyclerView
implementation 'androidx.recyclerview:recyclerview:1.3.2'
//apollo graphql
implementation 'com.apollographql.apollo:apollo-runtime:2.5.14'
implementation 'com.apollographql.apollo:apollo-coroutines-support:2.5.14'
//logging
implementation 'com.jakewharton.timber:timber:5.0.1'
//image handling
implementation 'com.github.bumptech.glide:glide:4.16.0'
kapt 'com.github.bumptech.glide:compiler:4.16.0'
//animations
implementation 'com.airbnb.android:lottie:6.2.0'
//shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'
//datastore
implementation "androidx.datastore:datastore-preferences:1.0.0"
//gson
implementation 'com.google.code.gson:gson:2.10.1'
//splash
implementation "androidx.core:core-splashscreen:1.0.1"
//mapbox
implementation 'com.mapbox.maps:android:11.0.0'
implementation "com.mapbox.navigation:android:2.17.6"
implementation "com.mapbox.navigation:ui-dropin:2.17.6"
//navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
//switch
implementation 'com.github.sigma1326:NiceSwitch:1.0'
//snackbar
implementation 'com.github.kishandonga:custom-snackbar:1.3'
//optview
implementation 'com.github.GoodieBag:Pinview:v1.5'
//circleimageview
implementation 'de.hdodenhof:circleimageview:3.1.0'
//rippleview
implementation 'com.balysv:material-ripple:1.0.2'
//testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
apollo {
generateKotlinModels.set(true)
schemaFile.set(file("src/main/graphql/com/example/wheeler/schema.json"))
}
Navigation v2 is not compatible with Maps v11, transferring this issue to Navigation SDK repo for more information on when this will be supported.
Any update on this? I am facing the same issue as well.
Im having the same issue, tried this:
api(map.navigation){ exclude group: 'com.mapbox.common', module:'okhttp' }
but having error on initialize the navigation on application class, i must use the navigation but i already upgrade my mapbox to v11 and dont want to downgrade this to v10 only to use navigation, i saw a beta v2.19 but already using mapbox v10, so v11 is far away to be supported.
This is a major issue as "navigation" users can't update to latest Mapbox version. @kiryldz can you at least confirm the intention of bringing support for v11 inside mapbox navigation v2? Or the expectation is to re-implement everything with the new navigation v3 (currently in "public preview")?
Thanks!
@bonnyfone Maps v11 is a major semver release so it is not expected (and even not possible from technical perspective) that it will be incorporated in Nav v2. I am not sure I understand "re-implement everything" part but new Nav v3 is the one compatible with Maps v11.
@bonnyfone Maps v11 is a major semver release so it is not expected (and even not possible from technical perspective) that it will be incorporated in Nav v2. I am not sure I understand "re-implement everything" part but new Nav v3 is the one compatible with Maps v11.
Thanks for the answer. I'm just wondering how much work will be to migrate from Navigation v2 to v3, I haven't seen any detail or migration guide in that regards, so it would be great if you could share some insights!
Here's the migration guide: https://docs.mapbox.com/android/navigation/build-with-coreframework/migration-from-v2/