简体   繁体   English

Espresso错误:与依赖项“ com.android.support:support-v4”发生冲突。 应用(24.2.0)和测试应用(23.1.1)的已解决版本不同

[英]Espresso Error:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (24.2.0) and test app (23.1.1) differ

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. 我已经升级到最新的API级别24,这是最新的API级别(在发生问题时),无论如何它都会导致此错误消息。

Error:Conflict with dependency 'com.android.support:support-v4'. 错误:与依赖项“ com.android.support:support-v4”冲突。 Resolved versions for app (24.2.0) and test app (23.1.1) differ. 应用(24.2.0)和测试应用(23.1.1)的已解决版本不同。 See http://g.co/androidstudio/app-test-app-conflict for details. 有关详情,请参见http://g.co/androidstudio/app-test-app-conflict

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. 同样, 此页面的第二答案给出了解决该问题的方法,但是如果您要在您的计算机中包含com.android.support.test.espresso:espresso-contrib:2.2.2 ,那么这将导致出现4条类似的错误消息。
So How can I get rid of these 4 extra error messages? 那么,如何摆脱这4条额外的错误消息呢?

Here are my Espresso build.gradle dependencies: 这是我的Espresso build.gradle依赖项:

    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 如果仍然卡住,请检查我项目的build.gradle文件: 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'. 错误:与依赖项“ com.android.support:support-v4”冲突。 Resolved versions for app (24.2.0) and test app (23.1.1) differ. 应用(24.2.0)和测试应用(23.1.1)的已解决版本不同。 See http://g.co/androidstudio/app-test-app-conflict for details. 有关详情,请参见http://g.co/androidstudio/app-test-app-conflict

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 它位于gradle文件的依赖项区域中
Likewise the error message 同样的错误信息

Error:Conflict with dependency 'com.android.support:appcompat-v7'. 错误:与依赖项“ com.android.support:appcompat-v7”冲突。 Resolved versions for app (24.2.0) and test app (23.1.0) differ. 应用(24.2.0)和测试应用(23.1.0)的已解决版本不同。 See http://g.co/androidstudio/app-test-app-conflict for details. 有关详情,请参见http://g.co/androidstudio/app-test-app-conflict

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 configurations.all {resolutionStrategy.force "com.android.support:appcompat-v7:23.1.0"}类推,直到解决所有错误为止ps不要忘了在这里找到主要解决方案(第二和第三答案向下

我的解决方案

您可以使用以下命令在测试中强制使用支持库:

androidTestCompile 'com.android.support:support-v4:24.2.0'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:与项目':app'中的依赖项'com.android.support:support-v4'发生冲突。 应用(25.3.1)和测试应用(23.1.1)的已解决版本不同 - Error:Conflict with dependency 'com.android.support:support-v4' in project ':app'. Resolved versions for app (25.3.1) and test app (23.1.1) differ 与依赖'com.android.support:support-annotations'冲突。 app(23.3.0)和测试app(23.1.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ 与项目':app'中的依赖'com.android.support:support-annotations'冲突。 app(26.1.0)和测试app(27.1.1)的已解决版本有所不同。 - Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. 与依赖'com.android.support:support-annotations'冲突。 app(23.1.0)和测试app(23.0.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ 与依赖项'com.android.support:support-v4'冲突 - Conflict with dependency 'com.android.support:support-v4' 无法升级到新的com.android.support:support-v4:24.2.0库 - Trouble upgrading to new com.android.support:support-v4:24.2.0 library 将Connect SDK添加到Gradle文件时与依赖项'com.android.support::support-v4'发生冲突 - Conflict with dependency 'com.android.support::support-v4' when adding Connect SDK to gradle file Google Dagger com.android.support:support-v4依赖版本 - Google Dagger com.android.support:support-v4 dependency versions 错误:与依赖项'com.android.support冲突:从23.1.1更新到23.4.0时 - Error:Conflict with dependency 'com.android.support: when update from 23.1.1 to 23.4.0 在 Android 中,将 AdMob 集成到我的应用程序时出现错误“找不到 com.android.support:support-v4:22.2.20” - In Android, error "could not find com.android.support:support-v4:22.2.20" while integrate AdMob into my App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM