更新协程到1.2.0后构建失败:META-INF / atomicfu.kotlin_module

问题描述 投票:10回答:1

更新到org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0 android构建失败后问题:More than one file was found with OS independent path 'META-INF/atomicfu.kotlin_module'

是否有任何解决方法使其工作?

android kotlin kotlin-coroutines
1个回答
16
投票

在app级别的build.gradle中添加以下内容到android级别: -

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

它看起来像: -

android {
  .......

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

1
投票

-dontwarn kotlinx.atomicfu.**添加到我的proguard规则文件中足以使我的构建与1.2.1库的kotlinx-coroutines-android版本一起使用。

在我的packagingOptions { pickFirst('META-INF/atomicfu.kotlin_module') }文件中添加packagingOptions { exclude('META-INF/atomicfu.kotlin_module') }build.gradle块不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.