2

I have tried many different ways of getting Vimeo networking into my app, but nothing has worked. If I remove the implementation it works just fine so I know this is the issue. compile 'com.vimeo.networking:vimeo-networking:1.1.1'

gives me this error

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I have searched all over and have yet to find a solution (yes I have tried cleaning and rebuilding the project)

4

2 回答 2

1

I believe this is the result of the vimeo-networking library including a dependency which you are also separately including in your gradle file. Looking at the gradle file for a hint, a prime suspect is the intellij annotations jar 'com.intellij:annotations:12.0@jar' dependency, which I have seen cause similar problems when also included in your main project as well as a sub-projects.

The solution to this is to exclude the annotations jar when compiling in the vimeo-networking library as follows:

compile ('com.vimeo.networking:vimeo-networking:1.1.1') {
    exclude group: 'org.jetbrains', module: 'annotations'
}

Try this and see if it fixes your build exception. Generally I've seen that the cause for the Unable to merge dex error is that there are multiple definitions of the same class in the final dex file, usually resulting from the inclusion of a jar file multiple times.

于 2017-11-14T22:03:49.970 回答
1

SOLUTION: anthonycr's answer was perfect, but I also had to do this:

implementation ("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version") {
    exclude group: 'org.jetbrains', module: 'annotations'
}

implementation ('com.vimeo.networking:vimeo-networking:1.1.1') {
    exclude group: 'org.jetbrains', module: 'annotations'
}
于 2017-11-15T17:10:22.907 回答