More than one file was found with OS independent path 'play-services-ads-identifier.properties'. code example

Example 1: More than one file was found with OS independent path 'META-INF/metadata.jvm.kotlin_module'

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") 
      }          
}

Example 2: More than one file was found with OS independent path 'META-INF/AL2.0'. when running android test

For android tests:
Downgrade coroutine version to 1.3.5 or use this code in app level gradle file
android {
    packagingOptions {
        exclude "**/attach_hotspot_windows.dll"
        exclude "META-INF/licenses/**"
        exclude "META-INF/AL2.0"
        exclude "META-INF/LGPL2.1"
    }
        }

Tags:

Java Example