android - 添加 Google Photos API 依赖项时发现重复的类

标签 android kotlin build.gradle google-photos-api

添加 Google 照片库 api 依赖项后抛出重复类发现错误

'com.google.photos.library:google-photos-library-client:1.5.0'

。几乎尝试了 SO 中的所有解决方案,但没有任何效果。

我的 Gradle(模块)文件(依赖项)

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
//    implementation project(':gcm')


    //design
    implementation 'androidx.appcompat:appcompat:1.2.0-alpha03'
    implementation "com.google.android.material:material:${design_version.design}"
    implementation "androidx.cardview:cardview:${design_version.card_view}"
    implementation "androidx.recyclerview:recyclerview:${design_version.recycler_view}"
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation "androidx.constraintlayout:constraintlayout:${design_version.constant_layout}"
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.makeramen:roundedimageview:2.3.0'

    implementation 'se.emilsjolander:StickyScrollViewItems:1.1.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    //image view
    implementation 'com.squareup.picasso:picasso:2.71828'

    //facebook integration
    implementation 'com.facebook.android:account-kit-sdk:4.37.0'

    //image cropper
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'

    //chart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    //glide
    implementation 'com.github.bumptech.glide:glide:4.9.0'

    //retrofit & square ok http & gson
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    implementation "com.squareup.okhttp3:okhttp-urlconnection:3.0.1"
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'com.squareup.okhttp3:okhttp:3.12.0'
    implementation 'com.google.code.gson:gson:2.8.6'

    //firebase
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-messaging:20.2.1'
    implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.7'
    implementation 'com.google.firebase:firebase-analytics:17.4.3'
    implementation 'com.google.firebase:firebase-config-ktx:19.1.4'
    implementation 'com.google.firebase:firebase-database-ktx:19.3.1'

    //validator
    implementation 'com.github.SoumikBhatt.toaster:validator:1.2.6'
    //popup
    implementation 'com.github.SoumikBhatt.toaster:custompopup:1.2.6'
    //proToast
    implementation 'com.github.SoumikBhatt:ToastLikeAPro:1.0.1'
    //Utils
    implementation 'com.github.SoumikBhatt:Utills:1.0.1'
    //force update
    implementation 'com.github.SoumikBhatt:PushNotification:1.1.5'

    //lottie
    implementation 'com.airbnb.android:lottie:3.4.0'

    //spotlight
    implementation 'com.github.takusemba:spotlight:2.0.1'

    //google photos
    implementation 'com.google.photos.library:google-photos-library-client:1.5.0'

    //flurry
//    api 'com.flurry.android:analytics:12.0.3@aar'
    implementation 'com.flurry.android:analytics:12.2.0'

    implementation 'com.google.android.gms:play-services-base:17.3.0'
    implementation 'com.google.android.gms:play-services-auth:18.0.0'
    implementation 'com.baoyz.swipemenulistview:library:1.3.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation "androidx.core:core-ktx:1.1.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

完全错误:

Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-1.17.0.jar (com.google.api.grpc:proto-google-common-protos:1.17.0) and jetified-protolite-well-known-types-17.0.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.0.0)
Duplicate class com.google.api.Advice$1 found in modules jetified-proto-google-common-protos-1.17.0.jar (com.google.api.grpc:proto-google-common-protos:1.17.0) and jetified-protolite-well-known-types-17.0.0-runtime.jar (com.google.firebase:protolite-well-known-types:17.0.0)
.
.
.

Go to the documentation to learn how to Fix dependency resolution errors.

任何形式的帮助都将受到高度赞赏。 TIA

最佳答案

Firebase 似乎也有类似的依赖关系。尝试抑制 gradle

中的依赖项之一

像这样在依赖项下面:

configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types') 

应该是类似这样的东西。

引用here

关于android - 添加 Google Photos API 依赖项时发现重复的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62639939/

相关文章:

android - 从本地 xml 解析 XML

kotlin - Kotlin 中没有 getter 的属性

安卓 Crashlytics ndk; build.gradle 中 NdkOut 和 NdkLibsOut 的值

java - MPAndroidChart:如何创建分组条形图?

下拉菜单忽略了Android布局填充

kotlin - 什么时候调用对象的 init block ?

java - 错误:任务 ':app:dexDebug'的执行失败。 > com.android.ide.common.process.ProcessException:

java - Android gradle 错误 :(69, 0) Gradle DSL 方法未找到: 'compile()'

android - google 和 maven 存储库之间的 play-services-measurement-base 版本不匹配

equals - 我可以将运算符添加到现有的类中吗?