Skip to content Skip to sidebar Skip to footer

Espresso Test Aren't Running After Adding Espresso-contrib Library In Gradle

When I'm adding the androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1' in the gradle and run an Espresso test, I get the following error: Testing star

Solution 1:

Please check my dependendecies, especially espresso ones.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    androidTestCompile "com.android.support:support-annotations:$ASVersion"
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
    androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }
    androidTestCompile 'com.android.support.test:runner:0.4.1'compile'com.squareup.retrofit:retrofit:1.9.0'compile"com.android.support:appcompat-v7:$ASVersion"compile"com.android.support:support-v4:$ASVersion"compile"com.android.support:design:$ASVersion"

}

where def ASVersion = '23.1.1'

Maybe you missed something. Mine already working

Hope it help

Solution 2:

Seems that you include RecyclerView component twice: here - compile 'com.android.support:recyclerview-v7:23.1.1' and here androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'. Add below code in your build.gradle after dependencies section and try again:

configurations {
    androidTestCompile.exclude group: 'com.android.support', module: 'recyclerview-v7'
}

Post a Comment for "Espresso Test Aren't Running After Adding Espresso-contrib Library In Gradle"