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

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

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.