如何修复“在 Android 中发现多个具有 OS 独立路径 'META-INF/DEPENDENCIES' 错误的文件

How to fix "More than one file was found with OS independent path 'META-INF/DEPENDENCIES' error in Android

我正在迁移到 google 驱动器 api v3 并根据此 sample 更新依赖项,如下所示:

implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.api-client:google-api-client-android:1.26.0') {
    exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
    exclude group: 'org.apache.httpcomponents'
}

但我遇到了这个错误:

More than one file was found with OS independent path 'META-INF/DEPENDENCIES'

并且不能运行应用程序

使用packagingOptionspickFirstexclude;认为应该省去排除:

android {
    packagingOptions {
        // pickFirst "META-INF/DEPENDENCIES"
        exclude "META-INF/DEPENDENCIES"
    }
}

1.25.01.26.0 之间的版本似乎也不匹配。当前版本是:

implementation "com.google.apis:google-api-services-drive:v3-rev173-1.25.0"

其他人可能也需要有版本 1.25.0