Skip to content

Build failed with ksp configuration name problem #852

@OumaSyuu

Description

@OumaSyuu

Ktorfit version

2.5.1

What happened and how can we reproduce this issue?

Multiplatform project build failed while changing the feature module plugin from com.android.library to com.android.kotlin.multiplatform.library.
I had change the kotlin multiplatform target from androidTarget to androidLibrary in build gradle file. Then I click the run button, it keeps telling me this message below:

Could not determine the dependencies of task ':feature_main:compileAndroidMain'.
> Task with path 'kspCommonMainKotlinMetadata' not found in project ':feature_main'.

What did you expect to happen?

Project successfully built.

Is there anything else we need to know about?

Here the new module build.gradle.kts file looks like:

plugins {
    alias(libs.plugins.kotlin.multiplatform)
//    alias(libs.plugins.android.library)
    alias(libs.plugins.android.kotlin.multiplatform.library)
    alias(libs.plugins.kotlin.symbolic.processing)
    alias(libs.plugins.kotlin.ktorfit)
    alias(libs.plugins.kotlin.serialization)
    alias(libs.plugins.kotlin.detekt)
}

kotlin {

// change kotlin target from androidTarget to androidLibrary 
    androidLibrary {

        ...

        withHostTestBuilder {
        }

        withDeviceTestBuilder {
            sourceSetTreeName = "test"
        }.configure {
            instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        }
    }

    jvm()

    sourceSets {
        commonMain {
            dependencies {
                // Add KMP dependencies here
                implementation(libs.kotlin.di.koin.core)
                implementation(libs.kotlin.ktorfit.lib)
                implementation(libs.bundles.kotlin.ktor.client)
                implementation(libs.kotlinx.serialization.json)

            }
        }

        commonTest {
            dependencies {
                implementation(libs.kotlin.test)
            }
        }

        androidMain {
            dependencies {
                // Add Android-specific dependencies here. Note that this source set depends on
                // commonMain by default and will correctly pull the Android artifacts of any KMP
                // dependencies declared in commonMain.
            }
        }

        getByName("androidDeviceTest") {
            dependencies {
                implementation(libs.androidx.test.runner)
                implementation(libs.androidx.test.core)
                implementation(libs.androidx.test.junit)
            }
        }

    }

}
dependencies {
    add("kspCommonMainMetadata", libs.kotlin.ktorfit.compiler)
//    add("kspCommonMainKotlinMetadata", libs.kotlin.ktorfit.compiler)
    add("kspAndroid", libs.kotlin.ktorfit.compiler)
    add("kspJvm", libs.kotlin.ktorfit.compiler)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions