Hi Guys... While running iosApp for Kmm I am getti...
# multiplatform
a
Hi Guys... While running iosApp for Kmm I am getting the error that is shown in the screenshot. However, the same code works for running Android app.Can anyone point me in the right direction? here is the shared gradle file
Copy code
plugins {
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
    id("org.jetbrains.compose")
}

kotlin {
    android {
        compilations.all {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        version = "1.0"
        ios.deploymentTarget = "14.1"
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "shared"
            isStatic=true
        }
    }
    
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(compose.runtime)
                implementation(compose.foundation)
                implementation(compose.material)
                implementation(compose.ui)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting {
            dependencies {
                // Android
                api(libs.androidx.activity.compose)
                api(libs.androidx.appcompat)
                api(libs.androidx.core.ktx)

                // Ktor
                api(libs.ktor.client.okhttp)
            }
        }
        val androidUnitTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)

        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }
    }
}

android {
    namespace = "com.retroent.moviebuff"
    compileSdk = 33
    defaultConfig {
        minSdk = 24
    }
}
k
does the official template work? https://github.com/JetBrains/compose-multiplatform-template if so, check your build config carefully
j
In my experience this was because of out-of-date/mismatched library versions in gradle
a
try using isStatic=true in framework
k
Don't recommend use static without real reasons!
a
@Abdul-Aziz-Niazi Yes i have used isStatic= true as well
a
@Konstantin Tskhovrebov current Compose for iOS is not compiling without isStatic=true This is already reported in other threads. Otherwise symbols not found error is generated on compile-time.
k
Yes, but it is not the case.
a
@Anshulupadhyay03 can you show us you App function?
a
@Abdul-Aziz-Niazi you are right mine is compose ios app . This is the App function
Copy code
@Composable
fun App(){
    Text("Hello")
}
k
show your build config. does it have an arm target?
a
@Anshulupadhyay03 I faced a similar issue when I created a new project. Make sure your Kotlin plugin versions match throughout the app. I had 1.8.0 and 1.8.20 for two different plugins.
a
@Abdul-Aziz-Niazi Thanks a lot buddy. this was exactly the issue for me.
a
Glad I could help 😄