Alberto Cappellina
Alberto Cappellina

Reputation: 327

Duplicated class error while adding dependencies | how remove specific class

i'm adding Intercom dependies to my project

 implementation "io.intercom.android:intercom-sdk:8.+'"

and i receive this errors:

Duplicate class okio.-Base64 found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-DeflaterSinkExtensions found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-DeprecatedOkio found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-DeprecatedUpgrade found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-DeprecatedUtf8 found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-GzipSinkExtensions found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-GzipSourceExtensions found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-InflaterSourceExtensions found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-Platform found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)
Duplicate class okio.-Util found in modules jetified-intercom-sdk-base-8.1.0-runtime.jar (io.intercom.android:intercom-sdk-base:8.1.0) and jetified-okio-jvm-2.4.3.jar (com.squareup.okio:okio:2.4.3)

i cannot found the rule to add to implementation to exclude this specific class okio.-Util and such. can anyone help ?

Thanks

Upvotes: 0

Views: 436

Answers (2)

Alberto Cappellina
Alberto Cappellina

Reputation: 327

I'll post an answer but it's very specific for this library, hope will help anyone.

Intercom default libraries come with some dependency inside the aar/jar. to avoid the issue there's a version without them here

https://www.intercom.com/help/en/articles/8716-using-transitive-dependencies-with-intercom-for-android

i ended up adding this library and everything worked.

Upvotes: 0

Martin Bove
Martin Bove

Reputation: 655

i know this way to exclude a whole package from a dependency, may be help you.

 // Retrofit
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation ("com.squareup.retrofit2:retrofit:$retrofitVersion") {
    exclude module: 'okhttp'
}

Upvotes: 1

Related Questions