NoClassDefFoundError exception occurs when using Ktor Client on older versions of Android

KtorClientNoClassDefFoundError

NoClassDefFoundError exception occurs when using Ktor Client on older versions of Android


Tested Android Version

Android 6.0 (Pixel 5, SDK 23)

How to reproduce

Run this app.

Log

Process: land.sungbin.ktorclientclassnofounderror.demo, PID: 2128
java.lang.NoClassDefFoundError: io.ktor.util.collections.ConcurrentMap$$ExternalSyntheticLambda1
	at io.ktor.util.collections.ConcurrentMap.computeIfAbsent(ConcurrentMapJvm.kt:19)
	at io.ktor.client.engine.cio.CIOEngine.selectEndpoint(CIOEngine.kt:123)
	at io.ktor.client.engine.cio.CIOEngine.execute(CIOEngine.kt:81)
	at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$2.invokeSuspend(HttpClientEngine.kt:99)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@87dcd69, Dispatchers.Main.immediate]

Tracked by KTOR-4751

GitHub

View Github