i added 'com.fasterxml.jackson.core:jackson-core:2.4.3'
module and 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.4.3'
to my android app project which use
'com.google.guava:guava-collections:r03'
module.
However as i try to build the APK i get this errror:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/common/annotations/Beta;
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:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
I runned gradlew -q :app:dependencies
which result is:
+--- com.android.support:support-v4:21.0.0 -> 21.0.2
| \--- com.android.support:support-annotations:21.0.2
+--- com.android.support:cardview-v7:21.0.+ -> 21.0.2
+--- com.android.support:recyclerview-v7:21.+ -> 21.0.2
| +--- com.android.support:support-v4:21.0.2 (*)
| \--- com.android.support:support-annotations:21.0.2
+--- com.eowise:recyclerview-stickyheaders:0.5.0
+--- project :library
| \--- com.android.support:appcompat-v7:20.0.0
| \--- com.android.support:support-v4:20.0.0 -> 21.0.2 (*)
+--- com.google.guava:guava-collections:r03
| +--- com.google.guava:guava-annotations:r03
| \--- com.google.guava:guava-primitives:r03
| \--- com.google.guava:guava-base:r03
| \--- com.google.guava:guava-annotations:r03
+--- com.fasterxml.jackson.core:jackson-core:2.4.3
\--- com.fasterxml.jackson.datatype:jackson-datatype-guava:2.4.3
+--- com.fasterxml.jackson.core:jackson-databind:2.4.3
| +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
| \--- com.fasterxml.jackson.core:jackson-core:2.4.3
+--- com.fasterxml.jackson.core:jackson-core:2.4.3
\--- com.google.guava:guava:15.0
So, the problem seems to be that my project uses guava module two times, one time in "jackson-dataype" and one time in "guava" module. I tried to exlude guava module from jackson-datatype with
compile ('com.fasterxml.jackson.datatype:jackson-datatype-guava:2.4.3'){
exclude module: 'guava'
}
but this results in a Error: duplicate files during packaging of APK
which suggests me to
ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
well, as i do this i get this while trying to sync gradle:
Gradle DSL method not found: 'packagingOptions()'
I'm stuck there, I'm sure i've got something wrong but i can't figure out what.
Finally, these are my gradle dependencies if needed:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.eowise:recyclerview-stickyheaders:0.5.0@aar'
compile project(':library')
compile 'com.google.guava:guava-collections:r03'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.3'
compile ('com.fasterxml.jackson.datatype:jackson-datatype-guava:2.4.3'){
exclude module: 'guava'
}
compile files('C:/.../mpandroidchartlibrary-1-7-3.jar')
}