【问题标题】:How to fix "More than one file was found with OS independent path 'META-INF/DEPENDENCIES' error in Android如何修复“在Android中发现多个文件与操作系统无关路径'META-INF/DEPENDENCIES'错误
【发布时间】:2020-10-02 21:57:42
【问题描述】:

我正在迁移到 google drive 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'
}

但我面临这个错误:

发现多个文件具有独立于操作系统的路径“META-INF/DEPENDENCIES”

并且无法运行应用程序

【问题讨论】:

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


    【解决方案1】:

    使用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

    【讨论】:

    • 你能解释一下为什么添加这个可以解决问题吗,META-INF/DEPENDENCIES 是什么意思?
    • 错误信息是什么意思?而META-INF/DEPENDENCIES 仅对 JAR 是必需的。
    猜你喜欢
    • 2018-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多