Several dex files define Lorg / apache / commons / io / CopyUtils; when upgrading to latest libraries

I have updated the AWS S3, JWPlayer and libup files to the latest version. Now I get the message "multiple dex files". I looked at all the other posts about this and tried what suggested. Bad luck.

../gradlew shows dependencies:

+--- com.amazonaws:aws-android-sdk-s3:2.4.0
|    +--- com.amazonaws:aws-android-sdk-core:2.4.0 (*)
|    +--- com.amazonaws:aws-android-sdk-kms:2.4.0
|    |    \--- com.amazonaws:aws-android-sdk-core:2.4.0 (*)
|    +--- org.apache.commons:commons-io:1.3.2
|    |    \--- commons-io:commons-io:1.3.2 -> 2.4
|    +--- commons-io:commons-io:2.4
|    \--- org.bouncycastle:bcprov-jdk16:1.44

      

I don't know if there are other links that are not listed in gradlew.

Here are the libraries:

repositories {
mavenCentral()

}

dependencies {
compile'com.amazonaws:aws-android-sdk-cognito:2.4.0'
compile'com.amazonaws:aws-android-sdk-s3:2.4.0'

compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:percent:25.0.0'
compile 'com.google.android.gms:play-services-analytics:10.2.1'

compile 'com.facebook.android:facebook-android-sdk:4.20.0'

compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile project(':jwplayer-android-sdk-2.4.2+159')

      

}

Help would be appreciated.

+3


source to share


3 answers


Replacement

compile 'com.amazonaws:aws-android-sdk-s3:2.4.0'

      

from



compile ('com.amazonaws:aws-android-sdk-s3:2.4.0') {
    exclude module: 'commons-io'
}

      

worked for me. Hooray!

+2


source


Both answers are about amazon AWS dependency, but I had the same issue after installing exclude command for all amazon dependencies. The problem was the other dependency I was using. To solve this problem, I put this command on Android Studio terminal:

gradlew app:dependencies

      



After that, I went through all the dependency hierarchies and found those that included shared rights. I put the same exception module command on all of them and the problem was resolved.

+2


source


When using Android Studio 3.0, this should be:

implementation('com.amazonaws:aws-android-sdk-s3:2.4.0') {
    exclude module: 'commons-io'
}

      

+1


source







All Articles