使用Android Studio 創(chuàng)建的新項目,出現(xiàn)一下錯誤
Error:Execution failed for task ':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.
兩種解決方法
1 使用高版本
修改app模塊build.gradle中support的版本誉简。
implementation 'com.android.support:appcompat-v7:27.1.1'
2 使用低版本柄沮。
app模塊build.gradle中添加如下配置
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:26.1.0'
}