1. 程式人生 > >Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versions for app (25.4.0) and test app

Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versions for app (25.4.0) and test app

Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versions for app (25.4.0) and test app (27.1.1) differ 問題解決

問題描述

Warning:Conflict with dependency 'com.android.support:support-annotations' in project ':xxx'. Resolved versions for app (25.4.0) and test app (27.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

  問題的意思就是說不能解決 25.4.0 和 測試 27.1.1 應用之間的差異,就是說 com.android.support:support-annotations 版本衝突了。

問題解決

  在 build.gradle 新增

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

  resolutionStrategy.force 是強制依賴的意思。

檢視文章

  https://www.jianshu.com/p/42fb70aa1602