tomtom-international / tomtom-navigation-android-examples

TomTom Navigation SDK examples
https://developer.tomtom.com/android/navigation/documentation/overview/introduction
Other
22 stars 4 forks source link

[Kotlin] duplicate class error: Duplicate com.google.protobuf classes when used with Firebase libraries #101

Open Czeach opened 1 month ago

Czeach commented 1 month ago

I am encountering a duplicate class error for com.google.protobuf classes when using the TomTom Maps or Navigation library and Firebase libraries in my Android project. This occurs because both the TomTom library and the Firebase library seem to include their own version of Protobuf.

Android Studio Jellyfish | 2023.3.1

kotlin version: 1.8.21

dependency versions being used:

    dependencies {
        // TomTom Map Display
        implementation 'com.tomtom.sdk.maps:map-display:1.2.0'

        // Firebase
        implementation platform('com.google.firebase:firebase-bom:33.0.0')
        implementation 'com.google.firebase:firebase-firestore'

    }

Current fix: I'm currently avoiding the error by excluding the libraries causing the duplication in configurations block and the project. I'm not sure that's a good fix but the project works fine with it.

configurations {
        implementation.exclude module:'protobuf-java'
    }