简体   繁体   中英

Android Espresso 2.2.1 Resolved versions for app and test app differ

Running tests via Android Studio, Gradle

Espresso:

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'

Library:

androidTestCompile 'com.android.support.test:testing-support-lib:0.1'

Runner:

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Error:A problem occurred configuring project ':application'.

> Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app and test app differ.

Just remove the androidTestCompile 'com.android.support.test:testing-support-lib:0.1' from your build.gradle . Take a look on example here .

Get comfortable with command-line Gradle. This tool help you find any conflicting dependencies when you run from console that command gradle -q app:dependencies .

Instead of deleting androidTestCompile 'com.android.support.test:testing-support-lib:0.1' from your app's build.gradle file, you can add exclude part like here.

androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
                   exclude module: 'support-annotations'

}

Hope it help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM