且构网

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

的冲突依赖“com.android.support:support-annotations~~V”。解决版本的应用程序(23.1.0)和测试应用程序(23.0.1)的不同

更新时间:2021-12-12 16:37:03

您可以使用强制标注库在您的测试:

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'
}