使用旧 Ktor 版本的 Android 库会导致 NoClassDefFoundError

问题描述 投票:0回答:0

我正在尝试将 TelemetryDeck 分析添加到使用 Ktor 2.0.0 的 Android 应用程序,但启动应用程序时出现错误,因为 TelemetryDeck 的 SDK 使用 Ktor 1.6.7

完整错误:

java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/features/HttpClientFeature;
                    at com.telemetrydeck.sdk.TelemetryClient.<init>(TelemetryClient.kt:18)
                    at com.telemetrydeck.sdk.TelemetryManager.send-gIAlu-s(TelemetryManager.kt:74)
                    at com.telemetrydeck.sdk.TelemetryBroadcastTimer$start$1$1.invokeSuspend(TelemetryBroadcastTimer.kt:48)
                    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
                    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
                    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
                    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@b96a820, Dispatchers.IO]
                 Caused by: java.lang.ClassNotFoundException: Didn't find class "io.ktor.client.features.HttpClientFeature" on path: DexPathList[[dex file "/data/data/com.mmm.example.debug/code_cache/.overlay/base.apk/classes10.dex", zip file "/data/app/~~3WLnofo17mW-pHZeEjjPaA==/com.mmm.example.debug-BXbaTkrc1DYfN-kyN2QXsg==/base.apk"],nativeLibraryDirectories=[/data/app/~~3WLnofo17mW-pHZeEjjPaA==/com.mmm.example.debug-BXbaTkrc1DYfN-kyN2QXsg==/lib/arm64, /data/app/~~3WLnofo17mW-pHZeEjjPaA==/com.mmm.example.debug-BXbaTkrc1DYfN-kyN2QXsg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                    ... 11 more

有办法修复它吗?或者我必须等到他们发布使用 Ktor 2.0.0 的新版本?

android kotlin noclassdeffounderror ktor ktor-client
© www.soinside.com 2019 - 2024. All rights reserved.