Sync gradle后出现以下错误
错误:任务':app:preDebugAndroidTestBuild'执行失败。
与依赖的冲突&com.google.code.findbugs:jsr305'在项目':app'。已解决的应用版本(1.3.9)和测试应用(2.0.1)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'
compile 'com.google.firebase:firebase-storage:11.6.0'
compile 'com.google.android.gms:play-services-drive:11.6.0'
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'pub.devrel:easypermissions:0.3.0'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-drive:v3-rev94-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
}
答案 0 :(得分:0)
在您的应用build.gradle
中添加:
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
强制Gradle只编译您为所有依赖项声明的版本号,无论依赖项声明了哪个版本号。
答案 1 :(得分:0)
手动添加2.0.1
的依赖项。冲突将得到解决。然后,所有依赖com.google.code.findbugs:jsr305
的库都将使用2.0.1
。
1.3.9
可能无效,因为其中一个依赖项需要更高版本。