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

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


You can add this in yourProject/app/build.gradle inside android{}. The exclude function adds the named resource to the list of resources that are not packaged in the APK.

android {            packagingOptions {        exclude 'META-INF/DEPENDENCIES'        exclude 'META-INF/LICENSE'        exclude 'META-INF/LICENSE.txt'        exclude 'META-INF/license.txt'        exclude 'META-INF/NOTICE'        exclude 'META-INF/NOTICE.txt'        exclude 'META-INF/notice.txt'        exclude 'META-INF/ASL2.0'        exclude("META-INF/*.kotlin_module")       }          }

The exclude function is deprecated in 7.0.2 and you should use something similar to this:

android {   ...   packagingOptions {       resources.excludes.add("META-INF/*")   }}


In my case it was enough to exclude only path 'META-INF/DEPENDENCIES' on yourProject/app/build.gradle inside android{} . Here it is

packagingOptions {    exclude 'META-INF/DEPENDENCIES'}

And then do Clean Project and Rebuild Project.


The solutions here didn't help me, but this link did.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {  packagingOptions {    pickFirst 'lib/armeabi-v7a/libassmidi.so'    pickFirst 'lib/x86/libassmidi.so'  }}

I was having this issue when using a React Native app as a library in an Android project. Hope it helps