Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

i'm migrating to google drive api v3 and updated dependencies according to this sample like this :

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'
}

but i'm facing to this error:

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

and can not run the app

like image 374
Javad Farokhi Avatar asked Oct 18 '25 07:10

Javad Farokhi


1 Answers

Use packagingOptions pickFirst or exclude; think it should be save to exclude it:

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

There also seems to be a version mismatch in between 1.25.0 and 1.26.0. Current version is :

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

and the others might need to have version 1.25.0, too.

like image 118
Martin Zeitler Avatar answered Oct 21 '25 12:10

Martin Zeitler