我在同步Gradle之后得到以下错误
错误:任务执行失败':app:predebugandroidtestbuild'。
与依赖项冲突'com.google.code.findbugs:jsr305'in project':app'。APP(1.3.9)和Test App(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'
}
}
在您的应用中 build.gradle
add:
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
不管依赖项所述的哪个版本编号,都将Gradle仅编译您对所有依赖的版本编号进行编译。
手动添加2.0.1
的依赖关系。冲突将得到解决。所有依赖com.google.code.findbugs:jsr305
的库将使用2.0.1
。
1.3.9
可能不起作用,因为其中一个依赖项需要更高的版本。