Android应用程序和测试apk:版本冲突

时间:2018-06-11 22:04:46

标签: android android-studio gradle

Android studio 3.0.1:创建新项目

错误:任务':app:preDebugAndroidTestBuild'执行失败。

> 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. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html 
for details.

版本是否会自动解析为更高版本? 这是android studio创建的全新项目。

   com.android.support.test:runner:1.0.2
        \ com.android.support:support-annotations:27.1.1

   com.android.support:appcompat-v7:26.1.0'
        \ com.android.support:support-annotations:26.1.0

1 个答案:

答案 0 :(得分:0)

只需从espresso中排除annotation地面:

androidTestImplementation('com.android.support.test.espresso:espresso- core:3.0.2') {
        exclude group: 'com.android.support', module: 'support-annotations'
   }