Closed alekseyHunter closed 1 month ago
Hi @alekseyHunter , are you using KSP2 (ksp.useKSP2=true) ? If so, Ktorfit is not compatible because of a bug in KSP2
I have an idea what the problem is. You are using the Kotlin multiplatform with only a single target. This might lead to the compile issues because the Kotlin compiler behaves different in that case. With Ktorfit 2.1.0 i fixed a issue related to that
With Ktorfit 2.1.0 i fixed a issue related to that
Hello!
It not works ;(
Is there a _UserApiImpl class in your build folder that gets generated? try it with get<Ktorfit>.create<UserApi>()
Yes: Perhaps this is an error:
java.lang.IllegalStateException: _UserApiProvider not found, did you apply the Ksp Ktorfit plugin? Use .createUserApi()
dependencies {
ksp("de.jensklingenberg.ktorfit:ktorfit-ksp:2.1.0-1.0.23")
}
Execution failed for task ':shared:kspDebugKotlinAndroid'.
Could not resolve all files for configuration ':shared:kspDebugKotlinAndroidProcessorClasspath'. Could not find de.jensklingenberg.ktorfit:ktorfit-ksp:2.1.0-1.0.23. Searched in the following locations:
Execution failed for task ':shared:javaPreCompileDebug'.
Could not resolve all files for configuration ':shared:_agp_internal_javaPreCompileDebug_kspClasspath'. Could not find de.jensklingenberg.ktorfit:ktorfit-ksp:2.1.0-1.0.23. Required by: project :shared
2.1.0 needs minimum KSP 1.0.24. Since Ktorfit 2.0.0 you don't need to add the ktorfit-ksp dependency manually, it will automatically be applied. Please take a look how it's done in the example project https://github.com/Foso/Ktorfit/tree/master/example/MultiplatformExample
Also doesn't works:
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinxSerialization) apply false
id("com.google.devtools.ksp") version "2.0.20-1.0.25" apply false
id("de.jensklingenberg.ktorfit") version "2.1.0" apply false
id("app.cash.sqldelight") version "2.0.2" apply false
}
buildscript {
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.23.2")
}
}
Try it again, I just released a version for ksp 1.0.25. I'm wondering why you didn't got an Grade error that ktorfit-ksp:2.1.0-1.0.25 could not been found, because it only exist till a few minutes
I encountered the same issue. After clearing the cache and restarting Android Studio, the problem was resolved.
I had the similar problem with KSP. I added all dependencies and plugins, but _apiImpl didn`t generated and createApi() extension too. I tried to use different versions, searched a lot of docs, but solution was very simple! in shared module build.gradle: ksp plugin "alias(libs.plugins.ksp)" must be before ktorfit plugin "alias(libs.plugins.ktorfit)". And after moving ksp plugin upper, it generated and built successful
thanks @adden00 it works as moved ksp to prior to ktorfit
Ktorfit version
2.0.0
What happened and how can we reproduce this issue?
Hello!
I got the same error as him: https://slack-chats.kotlinlang.org/t/18840838/hi-there-iam-able-to-update-kotlin-2-0-0-and-compose-android
libs.versions.toml
build.gradle
build.gradle
What did you expect to happen?
Can compile
Is there anything else we need to know about?
No response