Foso / Ktorfit

HTTP client generator / KSP plugin for Kotlin Multiplatform (Android, iOS, Js, Jvm, Native, WasmJs)) using KSP and Ktor clients inspired by Retrofit https://foso.github.io/Ktorfit
https://foso.github.io/Ktorfit
Apache License 2.0
1.6k stars 42 forks source link

[Android] App crashes if not using Ktor platform client #720

Closed Monabr closed 2 weeks ago

Monabr commented 4 weeks ago

Ktorfit version

2.1.0

What happened and how can we reproduce this issue?

So the docs states there is no need in additional configuration.

If I just use

            implementation(libs.ktorfit.lib)
            implementation(libs.ktor.client.serialization)
            implementation(libs.ktor.client.content.negotiation)
            implementation(libs.ktor.serialization.kotlinx.json)

and start the app - I get the error:

java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/plugins/HttpTimeout;

If I add platform clients (okhttp and darwin) and use them - the app works fine

What did you expect to happen?

Docs be accurate or there is was not bug

Is there anything else we need to know about?

No response

geworfener commented 2 weeks ago

Having the same problem, on iOS only though:

Caused by: kotlin.IllegalStateException: Failed to find HttpClientEngineContainer. Consider adding [HttpClientEngine] implementation in dependencies.

Foso commented 2 weeks ago

It's fixed with Ktorfit 2.2.0