Skip to content

Kotlin multiplatform support for iOS (and Android) #211

Description

Hi,

I am trying to integrate kinference in a Kotlin multiplaform project targeting mobile (Android and iOS). My project is an empty project newly generated from Android Studio Ladybug Feature Drop | 2024.2.2 selecting Kotlin Multiplatform App as template.

I am stuck in adding the dependency seems Android Studio complains about :shared:ios* : Could not resolve io.kinference:inference-core:0.2.26.

My repositories configuration settings.gradle.kts:

[...]

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()

        maven {
            url = uri("https://packages.jetbrains.team/maven/p/ki/maven")
        }

        maven {
            url = uri("https://packages.jetbrains.team/maven/p/grazi/grazie-platform-public")
        }
    }
}
[...]

My gradle version catalog libs.versions.toml:

[versions]
agp = "8.8.0"
kinference = "0.2.26"
kotlin = "2.0.0"
compose = "1.5.4"
compose-material3 = "1.1.2"
androidx-activityCompose = "1.8.0"

[libraries]
kinference-core = { group = "io.kinference", name = "inference-core", version.ref = "kinference" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
#kinference-onnx = { group = "io.kinference", name = "inference-onnx", version.ref = "kinference" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

My common build gradle file build.gradle.kts (:shared):

[...]
 sourceSets {
        commonMain.dependencies {
            //put your multiplatform dependencies here
            implementation(libs.kinference.core)
            //implementation(libs.kinference.onnx)
        }
        commonTest.dependencies {
            implementation(libs.kotlin.test)
        }
    }
[...]

When I hit "Sync Project with Gradle Files"
I see the packages being downloaded correctly:


Download https://packages.jetbrains.team/maven/p/ki/maven/io/kinference/inference-core/0.2.26/inference-core-0.2.26.module, took 411 ms
Download https://packages.jetbrains.team/maven/p/ki/maven/io/kinference/inference-core-jvm/0.2.26/inference-core-jvm-0.2.26.pom, took 454 ms
Download https://packages.jetbrains.team/maven/p/ki/maven/io/kinference/inference-core-jvm/0.2.24/inference-core-jvm-0.2.26.module, took 357 ms
Download https://packages.jetbrains.team/maven/p/ki/maven/io/kinference/utils-common/0.2.24/utils-common-0.2.26.pom, took 312 ms
[...]

🔴 But then I get the following error 🔴

:shared:iosArm64Main: Could not resolve io.kinference:inference-core:0.2.26.
Required by:
    project :shared

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html


// happens for all iOS architectures
:shared:iosArm64Test: Could not resolve io.kinference:inference-core:0.2.26.
:shared:iosSimulatorArm64Main: Could not resolve io.kinference:inference-core:0.2.26.
:shared:iosSimulatorArm64Test: Could not resolve io.kinference:inference-core:0.2.26.
:shared:iosX64Main: Could not resolve io.kinference:inference-core:0.2.26.
:shared:iosX64Test: Could not resolve io.kinference:inference-core:0.2.26.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions