Thursday, 6 April 2023

How can I fix the error Task 'wrapper' not found in project ':sample:native'?

I'm learning the libraries openai-kotlin for Open AI which is made by Mouaad Aallam, you can find it at https://github.com/Aallam/openai-kotlin .

There is a sample code project based the libraries at https://github.com/aallam/openai-kotlin/tree/main/sample/native.

When I open the sample project in Android Studio, I get the following error , you can see Result A.

1: How can I fix the error Task 'wrapper' not found in project ':sample:native' when I use Android Studio in Windows 10?

2: Is there other complete Android Studio demo project that is based on openai-kotlin?

Result A

Starting Gradle Daemon...
Gradle Daemon started in 1 s 404 ms
Type-safe project accessors is an incubating feature.
Project accessors enabled, but root project name not explicitly set for 'build-support'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.
> Task :build-support:compileKotlin UP-TO-DATE
> Task :build-support:compileJava NO-SOURCE
> Task :build-support:pluginDescriptors UP-TO-DATE
> Task :build-support:processResources UP-TO-DATE
> Task :build-support:classes UP-TO-DATE
> Task :build-support:jar UP-TO-DATE
> Task :build-support:inspectClassesForKotlinIC UP-TO-DATE

FAILURE: Build failed with an exception.

* What went wrong:
Task 'wrapper' not found in project ':sample:native'.

build.gradle.kts

plugins {
    kotlin("multiplatform")
}

kotlin {
    val hostOs = System.getProperty("os.name")
    val isMingwX64 = hostOs.startsWith("Windows")
    val nativeTarget = when {
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
    }
    nativeTarget.apply {
        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }
    sourceSets {
        val nativeMain by getting {
            dependencies {
                //implementation("com.aallam.openai:openai-client:<version>")
                implementation(projects.openaiClient)
                implementation(libs.ktor.client.curl)
            }
        }
    }
}


from How can I fix the error Task 'wrapper' not found in project ':sample:native'?

No comments:

Post a Comment