Skip to content Skip to sidebar Skip to footer

Duplicate Libraries In Two Different Project Modules

I have project with two modules. I'm using SalesforceSDK which is included as separate module and inside SalesforceSDK I have Cordova which is using okhttp. In second module I have

Solution 1:

if you are using android studio no need to delete you can use both library

just use

android {
    defaultConfig {
     ...
      multiDexEnabled = true
  }
}

using this statement is also required

dependencies 
{
    compile'com.android.support:multidex:1.0.0'
}

Solution 2:

Take a look at jarjar, which can let you use one version of OkHttp in one place and another somewhere else.

There are other similar tools (shade), and most of ‘em will work for you.

Solution 3:

I also have another solution for this issue. Firstly, I run this command line: enter image description here

and this is result:

enter image description here

I saw that Paypal also use okhttp library.So, I added this line to gradlew:

compile('com.paypal.sdk:paypal-android-sdk:2.13.3')
        {
            exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        }

And It aslo works fine for me.

Solution 4:

I was able to fix the issue by following this - https://developer.android.com/studio/build/dependencies#duplicate_classes

In my case, cordova-android-3.3.0.jar was a dependency in 2 different projects and one of those is a dependency of the other one.

Post a Comment for "Duplicate Libraries In Two Different Project Modules"