I have the following dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-moshi:2.3.0'
compile('com.github.eoinsha:JavaPhoenixChannels:0.2') {
exclude module: 'groovy-all'
}
}
And the following dependency tree:
+--- com.android.support:appcompat-v7:25.3.1
| +--- com.android.support:support-annotations:25.3.1
| +--- com.android.support:support-v4:25.3.1
| | +--- com.android.support:support-compat:25.3.1
| | | \--- com.android.support:support-annotations:25.3.1
| | +--- com.android.support:support-media-compat:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-core-utils:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-core-ui:25.3.1
| | | +--- com.android.support:support-annotations:25.3.1
| | | \--- com.android.support:support-compat:25.3.1 (*)
| | \--- com.android.support:support-fragment:25.3.1
| | +--- com.android.support:support-compat:25.3.1 (*)
| | +--- com.android.support:support-media-compat:25.3.1 (*)
| | +--- com.android.support:support-core-ui:25.3.1 (*)
| | \--- com.android.support:support-core-utils:25.3.1 (*)
| +--- com.android.support:support-vector-drawable:25.3.1
| | +--- com.android.support:support-annotations:25.3.1
| | \--- com.android.support:support-compat:25.3.1 (*)
| \--- com.android.support:animated-vector-drawable:25.3.1
| \--- com.android.support:support-vector-drawable:25.3.1 (*)
+--- com.squareup.retrofit2:retrofit:2.3.0
| \--- com.squareup.okhttp3:okhttp:3.8.0
| \--- com.squareup.okio:okio:1.13.0
+--- com.squareup.retrofit2:converter-moshi:2.3.0
| +--- com.squareup.retrofit2:retrofit:2.3.0 (*)
| \--- com.squareup.moshi:moshi:1.4.0
| \--- com.squareup.okio:okio:1.11.0 -> 1.13.0
\--- com.github.eoinsha:JavaPhoenixChannels:0.2
+--- com.fasterxml.jackson.core:jackson-databind:2.8.3
| +--- com.fasterxml.jackson.core:jackson-annotations:2.8.0
| \--- com.fasterxml.jackson.core:jackson-core:2.8.3
\--- com.squareup.okhttp3:okhttp-ws:3.4.1
\--- com.squareup.okhttp3:okhttp:3.4.1 -> 3.8.0 (*)
I get this error while trying to build the project:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
This is supposedly caused by the presence of two different versions of the okhttp library on the classpath:
3.4.1 by
com.squareup.okhttp3:okhttp-ws
which is a dependency ofJavaPhoenixChannels
3.8.0 by retrofit
Gradle should be able to automatically resolve this, so I wonder what's the probelm.
I tried to fix it by excluding okhttp
and okhttp-ws
from their respective first class dependencies and compile them separately but that doesn't seem to help.
Some explanation on why such errors would pop up is also appreciated.