Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build failed after update coroutines to 1.2.0: META-INF/atomicfu.kotlin_module

After update to org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0 android build failed with issue: More than one file was found with OS independent path 'META-INF/atomicfu.kotlin_module'

Are there any workaround to make it work?

like image 867
anber Avatar asked Apr 16 '19 07:04

anber


2 Answers

In app-level build.gradle add the following to android level :-

packagingOptions {
    pickFirst("META-INF/atomicfu.kotlin_module")
}

It would look like :-

android {
  .......

  packagingOptions {
    ......
    pickFirst("META-INF/atomicfu.kotlin_module")
  }
}
like image 54
Santanu Sur Avatar answered Nov 03 '22 16:11

Santanu Sur


Adding -dontwarn kotlinx.atomicfu.** to my proguard rules file was enough to get my build working with version 1.2.1 of the kotlinx-coroutines-android library.

Adding the packagingOptions { pickFirst('META-INF/atomicfu.kotlin_module') } or packagingOptions { exclude('META-INF/atomicfu.kotlin_module') } block in my build.gradle file didn't work.

like image 21
Adil Hussain Avatar answered Nov 03 '22 17:11

Adil Hussain