且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与依赖项 'com.android.support:support-annotations' 发生冲突.应用程序 (23.1.0) 和测试应用程序 (23.0.1) 的已解决版本不同

更新时间:2021-09-23 21:36:09

你可以在你的测试中强制使用注解库:

You can force the annotation library in your test using:

androidTestCompile 'com.android.support:support-annotations:23.1.0'

像这样:

  // Force usage of support annotations in the test app, since it is internally used by the runner module.
  androidTestCompile 'com.android.support:support-annotations:23.1.0'
  androidTestCompile 'com.android.support.test:runner:0.4.1'
  androidTestCompile 'com.android.support.test:rules:0.4.1'
  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-web:2.2.1'

另一种解决方案是在***文件中使用它:

Another solution is to use this in the top level file:

configurations.all {
    resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
}