Reputation: 122
I'am getting this error message when I try to add espresso libraries by gradle. How can I fix it ?
Upvotes: 0
Views: 309
Reputation: 603
use this code for testing actions like recyclerview
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2', {
exclude group: 'com.android.support', module: 'appcompact'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
})
or else use
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'appcompact'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
})
Upvotes: 0
Reputation: 655
Problem is that espresso uses older versions of support libraries than you are. Since you already have then in your project, exclude them from espresso. So, in your build.gradle file, you should replace:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
with:
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
If you have more conflicts, try excluding more support modules (like appcompat, design etc).
Upvotes: 2