DJ-DOO DJ-DOO - 6 months ago 38
Android Question

Android Espresso Issue - Dependency conflict

I'm trying to integrate espresso into my application for ui testing. Here are my dependencies in Gradle

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.1'
compile 'com.github.bumptech.glide:okhttp-integration:1.3.1@aar'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:cardview-v7:21.+'
compile 'com.android.support:recyclerview-v7:21.+'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
compile 'com.android.support:support-annotations:22.2.0'
androidTestCompile 'com.android.support.test:runner:0.3'
compile project(':common')
compile project(':service')
}


So all my espresso dependencies are included. However when I try to build I get this error:

Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (22.2.1) and test app (22.2.0) differ.


Has anyone encountered this? I've found it reported here however there's no resolution. Does anyone have a fix for this?

Answer

So after a lot of digging around, I found I needed to change the dependency for the support annotations.

So I needed to change compile 'com.android.support:support-annotations:22.2.0' to androidTestCompile 'com.android.support:support-annotations:22.+'