Joachim Prinsloo Joachim Prinsloo - 10 days ago 6
Android Question

Multiple dex files define Lio/codetail/animation/SupportAnimator$AnimatorListener;

I hope anybody can help me here. I am struggeling to my wits end with this and I cannot figure out what is wrong. I tried every solution in every similar post yet nothing worked.

My build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "xxxxxxxxxxxxxxxx"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
useLibrary 'org.apache.http.legacy'

}

repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile files('libs/android-async-http-1.4.4.jar')

compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'

androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestCompile 'com.android.support:support-annotations:25.0.0'

//compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.zomato:androidphotofilters:1.0.1'
//compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'

testCompile 'junit:junit:4.12'

compile 'com.google.firebase:firebase-invites:9.0.1'
compile 'com.unipiazza.materialtwostepslogin:materialtwostepslogin:0.1.4'
compile 'com.gordonwong:material-sheet-fab:1.2.1'
}
apply plugin: 'com.google.gms.google-services'


The issue started whe I added the library:

com.gordonwong:material-sheet-fab:1.2.1


It seems to be quite clear that there is a duplicate library somewhere that is also used in the com.gordonwong:material-sheet-fab:1.2.1 library But for the life of me I cannot figure out what or where and how to exclude it.

Help will be very much appreciated.

EDIT:

As suggested by crickets_007 in the comments (i think), I have run a dependancy report by going to the Gradle projects window and navigating to MyAppName > :app > Tasks > android and double clicking on androidDependancies which produced the dependancy report at the following link:

http://pastebin.com/u8Rtm9uu


Unfortunately I am not sure how to use this and what to do with this information.

I have also removed the com.gordonwong:material-sheet-fab:1.2.1 line from the gradle and recompiled the project as asked in the comments section and it works 100% so the problem is definitely something within tht library. Question is what and how do I exclude it???

EDIT:

What I have noticed is that

com.gordonwong:material-sheet-fab:1.2.1


has the following in it's Gradle:

compile 'com.github.asyl.animation:arcanimator:1.0.0'


Which can be seen here: https://github.com/gowong/material-sheet-fab/blob/master/material-sheet-fab/build.gradle

The following Library:

compile 'com.github.asyl.animation:arcanimator:1.0.0'


in turn has the following in it's Gradle:

compile 'com.nineoldandroids:library:2.4.0'


I cannot find nineoldandroid anywhere in my dependancy report but a lot of these errors I saw online is caused by this library which I find quite interesting.

Answer

I drilled down into the dependacies of the

com.gordonwong:material-sheet-fab:1.2.1 

library. The library includes the

com.github.asyl.animation:arcanimator:1.0.0 

library as a dependancy. Checking its dependancies I found it included the

com.nineoldandroids:library:2.4.0. 

DING DING!! What further made this interesting and was that the source on github is

ArcAnimator/sample/src/main/java/io/codetail/arcsample/

This looks very similar to my error.

The nineoldandroids library is a library is a name I have seen many times in threads about related "clashing" issues. I started to look deeper into my other libraries.

What sealed the deal was when I looked into the other libraries that I include. Upon drilling into the

com.unipiazza.materialtwostepslogin:materialtwostepslogin:0.1.4 

library I noticed that it includes the

com.github.ozodrukh:CircularReveal:1.1.1@aar 

library. When browsing this library there is a source path on github which looks like this:

CircularReveal/circualreveal/src/main/java/io/codetail/

You will notice that this also looks similar to my error. I went back to the inital library

com.gordonwong:material-sheet-fab:1.2.1

as I have now found my two conflicting libraries. I checked the issues tab to see if I have previously missed something but alas, this page was fruitless. I then noticed someone did a pull request and went to that tab (I was feeling lucky. Maybe this guy fixed it). AND BINGO:

io.codetail library removal from the project and included as a dependency

I followed through this thread and came to an answer as to how to exclude this library.

Even though all of this could have been avoided if I had just checked the pull request page before I went on a wilde goose chase, it eventually paid off.