While running my code with Android Studio, it generates this error:
Warning: Conflict with dependency 'com.squareup.okio: okio'. Resolved versions for app (1.11.0) and test app (1.6.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Perhap you are adding this library for expresso UI testing with retrofit2
androidTestCompile 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'
Here is what my solution look like:
androidTestCompile 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0',{
exclude group: 'com.squareup.okio', module: 'okio'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
It will keep gradle from downloading conflicting dependencies.
This problem happens because you added with androidTestCompile instead of normal compile. If you replace the former by the later, the error goes away. I think the reason is that gradle will selects the highest dependency's version.
If you go to the mentioned website (http://g.co/androidstudio/app-test-app-conflict) you can read the different options you have to solve this problem.
If you cannot narrow the conflicting libraries run first the following command, to see which versions are conflicting:
./gradlew :app:dependencies
There are two possible solutions to this problem:
1.- Change the libraries versions, so they do not conflict anymore
2.- Use Gradle Conflict Resolution Mechanism to specify the version you want to resolve to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With