在模块中找到重复的com.google.api.client.http.apache.ApacheHttpRequest类

时间:2019-05-17 18:46:47

标签: android gradle google-drive-api google-drive-android-api

我正在尝试为我的Android应用迁移到驱动器v3 api,并且我已按照https://github.com/gsuitedevs/android-samples/tree/master/drive/deprecation中提供的说明进行迁移。我遇到依赖性解析错误。

我使用了登录排除选项中显示的重复类,但没有用

我的驱动器api依赖项列表

implementation 'com.google.android.gms:play-services-ads:17.2.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.http-client:google-http-client-gson:1.29.1'

    implementation('com.google.api-client:google-api-client-android:1.28.0') {
        exclude group: 'org.apache.httpcomponents'
    }

    implementation('com.google.apis:google-api-services-drive:v3-rev99-1.23.0') {
        exclude group: 'org.apache.httpcomponents'
 }

下面显示的错误行

Duplicate class com.google.api.client.http.apache.ApacheHttpRequest found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ApacheHttpResponse found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ApacheHttpTransport found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ContentEntity found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.HttpExtensionMethod found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)

1 个答案:

答案 0 :(得分:0)

查看错误消息:

found in modules google-http-client-1.29.1.jar

似乎参考:

implementation 'com.google.http-client:google-http-client-gson:1.29.1'

基于版本号。您是否也尝试过从该文物中排除图书馆?