当前位置:   article > 正文

Duplicate class kotlinx.coroutines.AbstractCoroutine found in modules DataStore冲突解决_java.lang.runtimeexception: duplicate class kotlin

java.lang.runtimeexception: duplicate class kotlinx.coroutines.abstractcorou

错误内容:

Duplicate class kotlinx.coroutines.AbstractCoroutine found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.Active found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)

Duplicate class kotlinx.coroutines.channels.ChannelCoroutine found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelIterator found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelIterator$DefaultImpls found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelIterator$next0$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelKt found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__ChannelsKt found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__ChannelsKt$sendBlocking$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$all$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$any$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$any$3 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associate$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associateBy$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associateBy$2 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associateByTo$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associateByTo$3 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$associateTo$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$consumeEach$1 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)
Duplicate class kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt$consumeEach$3 found in modules kotlinx-coroutines-core-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9) and kotlinx-coroutines-core-jvm-1.3.9.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9)


原因是:
kotlinx-coroutines-core与kotlinx-coroutines-core-jvm 冲突所导致的
解决方案:
 implementation('androidx.datastore:datastore-preferences:1.0.0-alpha04'){
        exclude group:'org.jetbrains.kotlinx',module:'kotlinx-coroutines-core-jvm'

    }


或者

```java

implementation('androidx.datastore:datastore-preferences:1.0.0-alpha04'){

    excludegroup:'org.jetbrains.kotlinx',module:'kotlinx-coroutines-core'

    excludegroup:'org.jetbrains.kotlinx',module:'kotlinx-coroutines-core-jvm'

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/697528
推荐阅读
相关标签
  

闽ICP备14008679号