https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

chi

03/30/2024, 2:13 PM
Hello everyone, In my multiplatform project, I’m getting this error when I try to run app on iOS, how do I resolve this please?
Copy code
:composeApp:compileKotlinIosX64 FAILED
Could not find "androidx.lifecycle:lifecycle-runtime"
My shared module common dependencies looks like;
Copy code
commonMain.dependencies {
            implementation(libs.coroutineCore)
            implementation(libs.kotlinx.serialization)
            implementation(project.dependencies.platform(libs.supabaseBom))
            implementation(libs.sbPostgres)
            implementation(libs.sbRealStorage)
            implementation(libs.sbRealTime)
            implementation(libs.bundles.ktor.common)
            api(libs.koinCore)

        }
My commonApp module dependencies looks like this and it already had the runtime common compose dependency
Copy code
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            
            implementation(compose.ui)
            implementation(compose.material3)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)

            implementation(project.dependencies.platform(libs.koinBom))
            implementation(libs.koinCore)
            implementation(libs.koinCompose)

            implementation(libs.androidx.lifecycle.viewmodel.compose) //"org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose:0.0.0-nav-dev1547"

            implementation(projects.shared)

        }
a

Ana Sekuloski

04/01/2024, 12:17 PM
androidx.lifecycle:lifecycle-runtime
I’m pretty sure this is Android lib only and cannot be used on common (shared) code. You can add in
androidMain
dependencies. I only know that
androidx.lifecycle
is supported so far for KMP - https://developer.android.com/jetpack/androidx/releases/lifecycle#version_28_2
4 Views