1. 程式人生 > >Androidstudio 建立專案報錯

Androidstudio 建立專案報錯

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.3.1) and test app (25.4.0) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

在build.grandle 中,有一個Android{},在括號中新增如下程式碼

 configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}

1衝突

Error:Conflict with dependency ‘com.android.support:support-annotations’ in project ‘:app’. Resolved versions for app (25.1.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict

for details.

解決方法 在app gradle 中新增如下

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

完美解決

2 衝突

Error:Conflict with dependency ‘com.google.code.findbugs:jsr305’ in project ‘:app’. Resolved versions for app (3.0.1) and test app (2.0.1) differ. See

http://g.co/androidstudio/app-test-app-conflict for details.

解決方法 在app gradle 中新增如下

configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
}