gpt4 book ai didi

android - java.lang.ClassNotFoundException : Didn't find class "kotlinx.coroutines.experimental.Deferred"

转载 作者:IT老高 更新时间:2023-10-28 13:46:54 33 4
gpt4 key购买 nike

我在使用带有改造的协程时遇到了这个问题,你能告诉我为什么会出现这个错误

java.lang.ClassNotFoundException:在路径上找不到类“kotlinx.coroutines.experimental.Deferred”:DexPathList[[zip 文件“/data/app/com.coroutines.retrofit.kotlin-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64,/system/lib64]]

当我使用以下依赖项时,

实现 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0'

实现 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'实现 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'

而 kotlin 版本是:ext.kotlin_version = '1.3.10'

最佳答案

Add this dependency in your build.gradle : (remove experimental dependency for coroutine)

dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
}

And add CoroutineCallAdapterFactory() for retrofit

addCallAdapterFactory(CoroutineCallAdapterFactory())

关于android - java.lang.ClassNotFoundException : Didn't find class "kotlinx.coroutines.experimental.Deferred",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53700414/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com