Yusuf Erdoğan
Yusuf Erdoğan

Reputation: 122

Android Espresso Framework Resolved versions for app (25.3.1) and test app (23.1.1) Error

I'am getting this error message when I try to add espresso libraries by gradle. How can I fix it ?

Upvotes: 0

Views: 309

Answers (2)

Naga Lokesh Kannumoori
Naga Lokesh Kannumoori

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

Crepi
Crepi

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

Related Questions