Ktorfit: [Bug]: java.lang.IllegalStateException: not found, did you apply the Ksp Ktorfit plugin?
Ktorfit version
1.4.1
What happened and how can we reproduce this issue?
just create a Library with KMM and try to implement like the Docs got this error when ./gradlew build
build.gradle.kts
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
kotlin("plugin.serialization") version "1.8.21"
id("com.android.library")
id("com.google.devtools.ksp") version "1.8.21-1.0.11"
id("de.jensklingenberg.ktorfit") version "1.0.0"
}
version = "1.0"
val ktorVersion = "2.3.1"
val ktorfitVersion = "1.4.1"
configure<de.jensklingenberg.ktorfit.gradle.KtorfitGradleConfiguration> {
version = ktorfitVersion
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
kotlin {
targetHierarchy.default()
android {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
iosX64()
iosArm64()
iosSimulatorArm64()
jvm(){
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
framework {
baseName = "shared"
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("de.jensklingenberg.ktorfit:ktorfit-lib:$ktorfitVersion")
//implementation("de.jensklingenberg.ktorfit:ktorfit-lib-light:$ktorfitVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
//Only needed when you want to use Kotlin Serialization
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
}
}
val androidMain by getting {
dependencies {
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by getting {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies {
}
}
}
}
android {
namespace = "com.example.kmmartifact"
compileSdk = 33
defaultConfig {
minSdk = 24
}
}
dependencies {
add("kspCommonMainMetadata", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")
add("kspJvm", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")
add("kspAndroid", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")
add("kspIosX64", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")
add("kspIosSimulatorArm64", "de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion")
}
What did you expect to happen?
error shouldn’t happen
Is there anything else we need to know about?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 27 (7 by maintainers)
Cool to see that you could help each other out 😃 I will close this issue, because the discussion drifted a bit away from the original bug issue. In case there are any other bugs, please open a new issue
Use this module into
sharedmodule byand remove moko resources related plugin and repo from shared module
I hope this will help you @samandar-me
@k-kertykamary I looked at your project, i think the problem is not Ktorfit but moko-resources. It looks like that is not compatible with Kotlin 1.9.10 https://github.com/icerockdev/moko-resources/issues/535. I when i disabled Moko, there were no compile errors.
Btw: you should also update the Ktorfit Gradle plugin to 1.8.1
@samandar-me I don’t have example in github. Because i have used in a production app. Let me give you an example
Oh, really? I’m so sorry for the trouble. Alright, I’ll check for moko. Thanks a lot.
Hello @Foso I add you tu the repo 😉 https://github.com/k-kertykamary/km2-ktofit Thanks in advance
To reproduce, just uncomment :
in shared/build.gradle.kts
@JamshedAlamQaderi Sorry, i don’t know why you are getting this error, i never had problems with it. Please take a look if the example project does something different https://github.com/Foso/Ktorfit/tree/master/example/MultiplatformExample or give me some example project where i can reproduce that error