【问题标题】:Warning:Conflict with dependency 'com.android.support:support-annotations' (25.0.1)警告:与依赖项 'com.android.support:support-annotations' (25.0.1) 冲突
【发布时间】:2016-11-15 15:00:39
【问题描述】:

好的,我知道,类似的问题已被多次询问,但我找不到解决问题的方法。 我需要测试我的应用程序。所以我按照教程告诉我添加 Android 运行器支持。

androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'

问题是,这似乎与我的兼容库不兼容。

compile 'com.android.support:appcompat-v7:25.0.1' 
compile 'com.android.support:design:25.0.1'

但由于我们针对 API 级别 25 进行开发,因此需要这些库。所以我想回到第 23 版不是一个选择。

那么我怎样才能让它运行呢?我错过了什么吗?

【问题讨论】:

  • 感谢您的链接,但这是关于旧版本的。测试运行器在 v.23 之前是兼容的,但我不确定如何处理我的 API 级别 25 的项目。

标签: android testing integration-testing android-espresso


【解决方案1】:
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'

参考旧版supportAnnotations

com.android.support:support-annotations:23.1.1

你有几个选择:

  1. 专门声明suportAnnotations版本用于测试编译(覆盖任何传递依赖):

    androidTestCompile 'com.android.support:support-annotations:25.0.1'
    
  2. 从这些依赖项中排除它:

    androidTestCompile ('com.android.support.test:runner:0.5') {
        exclude module: 'support-annotations'
    }
    androidTestCompile ('com.android.support.test:rules:0.5') {
        exclude module: 'support-annotations'
    }
    

【讨论】:

    猜你喜欢
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 2018-11-20
    • 1970-01-01
    • 2016-11-05
    • 2019-08-08
    • 2021-11-05
    • 2016-08-02
    相关资源
    最近更新 更多