错误:程序类型已存在: com.google.api.AuthProviderOrBuilder
完成Google Photos集成并将以下依赖项添加到我的项目后,我遇到上述错误:
implementation 'com.google.photos.library:google-photos-library-client:1.1.0'
implementation 'com.google.apis:google-api-services-oauth2:v2-rev141-1.25.0'
implementation group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.23.0'
这是完整的应用程序级别gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app.package”
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName “1.0.0”
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions “appName”
productFlavors {
dev {
dimension “appName”
applicationId "com.app.package"
resValue 'string', 'package_name', defaultConfig.applicationId
}
prod {
dimension "appName"
resValue 'string', 'package_name', defaultConfig.applicationId
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// for fused location provider - to get the last known location
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-basement:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-awareness:16.0.0'
// firebase
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:3.1.1'
implementation 'com.google.firebase:firebase-config:16.0.1'
// sphericalUtil to calculate distance between in meters
implementation 'com.google.maps.android:android-maps-utils:0.5'
// Gson
implementation 'com.google.code.gson:gson:2.8.5'
// google directions api
implementation 'com.google.maps:google-maps-services:0.2.5'
// for crashlytics
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true
}
//Voice assistant
implementation 'ai.api:sdk:2.0.7@aar'
implementation 'ai.api:libai:1.6.12'
implementation 'commons-io:commons-io:2.6'
// glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
// mapbox
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.5.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-services:2.1.0'
//Hashtags helper library
implementation 'com.github.danylovolokh:hashtag-helper:1.1.0'
// google-places-api
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
// RxJava2
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
implementation 'android.arch.persistence.room:rxjava2:1.1.1'
//For Instagram like dots below in a ViewPager
implementation 'com.github.hrskrs:InstaDotView:1.1'
//For workManager
implementation('android.arch.work:work-runtime:1.0.0-alpha10') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
//Image cropping library
implementation 'com.github.yalantis:ucrop:2.2.2'
//Video compressor
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.1'
//Firebase deeplink
implementation 'com.google.firebase:firebase-dynamic-links:16.1.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.makeramen:roundedimageview:2.3.0'
//Swipe button library
implementation 'com.ebanx:swipe-button:0.4.0'
//Google Photos Library
implementation 'com.google.photos.library:google-photos-library-client:1.1.0'
implementation 'com.google.apis:google-api-services-oauth2:v2-rev141-1.25.0'
implementation group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.23.0'
}
apply plugin: 'com.google.gms.google-services'
根据Android文档here,我发现这是重复的类错误,我缩小了.idea / libraries下的以下库,这些库可能会引起冲突:
Gradle__org_threeten_threetenbp_1_3_3_jar.xml
Gradle__io_grpc_grpc_auth_1_10_1_jar.xml。 Gradle__com_google_api_gax_grpc_1_29_0_jar.xml
Gradle__com_google_api_api_common_1_6_0_jar.xml
但是,如果我尝试删除这些文件,则在“清理并重建”项目后,库会再次显示,并且出现相同的错误。
任何帮助将不胜感激。谢谢。