Before you claim DUPLICATE please read the question.
This only occurs with the latest version of the build tools. Older versions do not display this problem. I've already tried the solutions offered on other questions here for multiple definitions of @AnimRes
. None have helped so far, which is why I posted a new question. Same symptoms, different cause, different solution.
I can build without problem when using buildToolsVersion 22.0.1
, but when I switch to buildToolsVersion 23
the build fails with error
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106)
This is a list of my dependencies:
provided 'org.projectlombok:lombok:1.16.4'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v13:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:palette-v7:23.0.0'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.guava:guava:18.0'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.4'
compile 'commons-codec:commons-codec:1.10'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
compile 'org.jsoup:jsoup:1.7.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.flaviofaria:kenburnsview:1.0.6'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.getbase:floatingactionbutton:1.10.0'
compile 'com.nispok:snackbar:2.10.10'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'de.hdodenhof:circleimageview:1.3.0'
To ensure everyone (including Espresso) uses the same version of the support-annotations
I have the following in my build file:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.0'
}
Removing this will cause other failures.
Is this a possible bug in the build tools or am I doing something wrong?
I've tried setting Incremental false
in dexOptions
. It didn't help.
Using ./gradlew -q app:dependencies
I get the following:
+--- com.android.support:support-v4:23.0.0
| \--- com.android.support:support-annotations:23.0.0
+--- com.android.support:appcompat-v7:23.0.0
| \--- com.android.support:support-v4:23.0.0 (*)
+--- com.android.support:support-v13:23.0.0
| \--- com.android.support:support-v4:23.0.0 (*)
+--- com.android.support:cardview-v7:23.0.0
+--- com.android.support:palette-v7:23.0.0
| \--- com.android.support:support-v4:23.0.0 (*)
+--- com.google.code.findbugs:jsr305:2.0.1
+--- com.google.guava:guava:18.0
+--- com.github.chrisbanes.photoview:library:1.2.3
| \--- com.android.support:support-v4:19.+ -> 23.0.0 (*)
+--- org.apache.commons:commons-lang3:3.4
+--- commons-io:commons-io:2.4
+--- commons-codec:commons-codec:1.10
+--- com.jakewharton:butterknife:7.0.1
+--- com.squareup:otto:1.3.8
+--- org.jsoup:jsoup:1.7.2
+--- com.squareup.picasso:picasso:2.5.2
+--- com.squareup.retrofit:retrofit:1.9.0
| \--- com.google.code.gson:gson:2.3.1
+--- com.squareup.okhttp:okhttp:2.4.0
| \--- com.squareup.okio:okio:1.4.0 -> 1.5.0
+--- com.squareup.okhttp:okhttp-urlconnection:2.4.0
| \--- com.squareup.okhttp:okhttp:2.4.0 (*)
+--- com.squareup.okio:okio:1.5.0
+--- com.flaviofaria:kenburnsview:1.0.6
+--- com.edmodo:cropper:1.0.1
+--- com.getbase:floatingactionbutton:1.10.0
| \--- com.android.support:support-annotations:22.2.0 -> 23.0.0
+--- com.nispok:snackbar:2.10.10
| +--- com.android.support:recyclerview-v7:22.0.0
| | +--- com.android.support:support-v4:22.0.0 -> 23.0.0 (*)
| | \--- com.android.support:support-annotations:22.0.0 -> 23.0.0
| \--- com.android.support:support-annotations:22.0.0 -> 23.0.0
+--- com.github.ksoichiro:android-observablescrollview:1.5.2
| \--- com.android.support:recyclerview-v7:21.0.0 -> 22.0.0 (*)
+--- in.srain.cube:grid-view-with-header-footer:1.0.12
\--- de.hdodenhof:circleimageview:1.3.0