mapbox / mapbox/mapbox-navigation-android

Duplicate class on build

Open
#7,652 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :beetle:
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

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.

dependencies_output.txt

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"))
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided build.gradle and dependencies_output.txt, focusing on the Mapbox Maps and Navigation dependencies and the duplicate common/okhttp modules. Reproduce the Android build and identify a compatible dependency resolution; done means the build completes without duplicate-class errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.