I have upgraded to the latest API level 24 which is the latest API Level (at time of writhing) anyhow it caused this error message.
Error:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (24.2.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
So How can I fix this?
Also this page the 2nd answer down gives a solution to the problem but if you want to include com.android.support.test.espresso:espresso-contrib:2.2.2
in your then this will lead to 4 more similar error messages.
So How can I get rid of these 4 extra error messages?
Here are my Espresso build.gradle dependencies:
androidTestCompile "com.android.support:support-annotations:$SUPPORT_VERSION"
androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile "com.android.support.test.espresso:espresso-intents:$ESPRESSO_VERSION"
/**
* AccessibilityChecks
* CountingIdlingResource
* DrawerActions
* DrawerMatchers
* PickerActions (Time and Date picker)
* RecyclerViewActions
*/
androidTestCompile("com.android.support.test.espresso:espresso-contrib:$ESPRESSO_VERSION") {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v7'
exclude group: 'com.android.support', module: 'design'
exclude module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
where:
ESPRESSO_VERSION = '2.2.2'
Check my project's build.gradle
file if you still stuck: https://github.com/piotrek1543/LocalWeather/blob/master/app/build.gradle
Hope it will help
I found a solution (workaround) If you click on the picture below you will note look at the picture below you will note that the error message
Error:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (24.2.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
will be fixed with the line
configurations.all {resolutionStrategy.force "com.android.support:support-v4:23.1.0"}
Which is located in the dependencies area of the gradle file
Likewise the error message
Error:Conflict with dependency 'com.android.support:appcompat-v7'. Resolved versions for app (24.2.0) and test app (23.1.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
can be fixed with the line
configurations.all {resolutionStrategy.force "com.android.support:appcompat-v7:23.1.0"}
And so on and so fourth until all the errors are solved ps Don't forget to go here for the main solution (2nd and 3rd answer down
您可以使用以下命令在测试中强制使用支持库:
androidTestCompile 'com.android.support:support-v4:24.2.0'
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.