Getting this error when trying to run a sampleApp ...
# ktor
s
Getting this error when trying to run a sampleApp in
runDistribution
mode. The app is using the local projects as library This DOES NOT happen when running in
runRelease
mode
Copy code
java.lang.NoClassDefFoundError: java/net/http/HttpClient$Version
java/net/http/HttpClient$Version kotlin.Unit
I am using Ktor v "2.3.12" in Kotlin Multiplatform. The app works find for android.
a
What version of JDK do you use?
s
I'm using version 17. For Ktor I've tried using both v2.3.12 and v3.0.0-beta-1.
a
Can you check that your project doesn't contain conflicting versions of Ktor?
s
Copy code
ktor = "3.0.0-beta-1" // tried with v2.3.12 too

ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
These are the only ktor dependencies in my project.
a
Can you check that via the Gradle "dependencies" command?
s
Sure... Bth this is the stack trace
Copy code
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See <http://www.slf4j.org/codes.html#StaticLoggerBinder> for further details.
java.lang.NoClassDefFoundError: java/net/http/HttpClient$Version
	at io.ktor.client.engine.java.JavaHttpConfig.<init>(JavaHttpConfig.kt:18)
	at io.ktor.client.engine.java.Java.create(Java.kt:30)
	at io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:43)
	at io.ktor.client.HttpClientJvmKt.HttpClient(HttpClientJvm.kt:23)
	at com.gyanoba.inspektor.sample.data.Api$client$2.invoke(Api.kt:13)
Unable to build my project as I was trying some things.. Will post the output once done.. Thanks a lot 👍
Hello Aleksei! The issue seems to be resolved when I switched my project structure to official plugin template from KMP Wizard. Here's the dependencies command log from the old project anyway https://we.tl/t-FAmqVBekr3 Thanks 🙏