【问题标题】:Build failed after update coroutines to 1.2.0: META-INF/atomicfu.kotlin_module将协程更新到 1.2.0 后构建失败:META-INF/atomicfu.kotlin_module
【发布时间】:2019-04-16 07:21:07
【问题描述】:

更新到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】:

    在应用级build.gradle 中将以下内容添加到android 级:-

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

    看起来像:-

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

    【讨论】:

    • 在 kotlin slack 频道 exclude 'META-INF/*.kotlin_module' 上也有人建议。带proguard设置-dontwarn kotlinx.atomicfu.**
    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 2020-04-19
      • 2012-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-11
      • 2021-03-15
      • 2015-02-17
      相关资源
      最近更新 更多