Hi everyone, hope you are all doing well. I am stu...
# compose-ios
d
Hi everyone, hope you are all doing well. I am stuck with an issue that I cannot update compose jetbrains to version
1.6.0-beta01
It is working fine on Android, but is causing issue for iOS devices. I think it might started happening when I started using sqldelight maybe 🤔 but I am not sure honestly. here is my
build.gradle.kts
is in the 🧵 Issue I am getting when updating to a new version is the following Error I am getting is in this stacktrace I was recommended to download and use the new kmp wizard version but the project is too large atm in my opinion for doing that. Could someone tell what could new kmp wizard change so I could somehow migrate 🤔
build.gradle.kts
Copy code
import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsCompose)
    alias(libs.plugins.gradle.buildconfig.plugin)
    alias(libs.plugins.kotlinSerilization)
    alias(libs.plugins.sqldelight)
    id("dev.icerock.mobile.multiplatform-resources")
}

repositories {
    google()
    mavenCentral()
}

kotlin {
    applyDefaultHierarchyTemplate()
    androidTarget {
        compilations.all {
            kotlinOptions {
                jvmTarget = "11"
            }
        }
    }

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            linkerOpts.add("-lsqlite3") // not needed but I remember it being needed before
            baseName = "ComposeApp"
            isStatic = false // THIS HAD TO BE CHANGED FOR SQLDELIGHT TO WORK
            // isStatic = true // this had to be changed  for MOKO-RESOURCES to work
        }
    }

    sourceSets {
        androidMain.dependencies {
            implementation(libs.compose.ui)
            implementation(libs.compose.ui.tooling.preview)
            implementation(libs.androidx.activity.compose)
            implementation(libs.ktor.client.android)
            implementation(libs.decompose)
            implementation(libs.sqldelight.android)
            implementation(libs.koin.android)
        }
        iosMain.dependencies {
            implementation(libs.ktor.client.darwin)
            implementation(libs.sqldelight.native)
        }
//        val iosSimulatorArm64Main by getting {
//            dependsOn(commonMain.get())
//        }
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material3)
            @OptIn(ExperimentalComposeLibrary::class)
            implementation(compose.components.resources)
            implementation(libs.kotlinx.datetime)
            implementation(libs.bundles.ktor)
            implementation(libs.kotlinx.serialization)
            implementation(libs.ktor.client.logging)
            implementation(libs.ktor.client.auth)
            implementation(libs.kermit)
            implementation(libs.moko.resources)
            implementation(libs.moko.resources.compose)
            implementation(libs.multiplatform.settings)
            implementation(libs.multiplatform.settings.noarg)
            implementation(libs.decompose)
            implementation(libs.decompose.compose)
            implementation(libs.kamel)
            implementation(libs.compose.fontawesome.icons)
            implementation(libs.koin.core)
            implementation(libs.kotlinx.immutable.collections)
            implementation(libs.sqldelight.coroutines)
        }
    }
}

android {
    namespace = "?"
    compileSdk = libs.versions.android.compileSdk.get().toInt()

    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    sourceSets["main"].res.srcDirs("src/androidMain/res")
    sourceSets["main"].resources.srcDirs("src/commonMain/resources")

    defaultConfig {
        applicationId = "?"
        minSdk = libs.versions.android.minSdk.get().toInt()
        targetSdk = libs.versions.android.targetSdk.get().toInt()
        versionCode = 1
        versionName = "1.0"
    }
    buildFeatures {
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    dependencies {
        debugImplementation(libs.compose.ui.tooling)
    }
}

multiplatformResources {
    resourcesPackage.set("?")
}

buildConfig {
    buildConfigField(
        "String",
        "BASE_URL",
        "\"???""
    )
}

sqldelight {
    databases {
        create("LunchBreakDatabase") {
            packageName.set("org.example.lunchbreak")
        }
    }
}
d
Hello! I will try to prepare this instructions
I found, there was an Issue with version 1.6.0-beta01 So, you can try to use Compose 1.6.0-rc02
d
Same issue happens with
rc02
version, is there some stacktrace or similar I can provide that would be of help?
👀 1
@Dima Avdeev
but I have that issue with collections on beta01, yes
d
I checked you build.gradle file and don't saw any problems. Can you try to create a minimal reproducible sample of this Issue? I can describe steps you can follow: • Remove all code from project src/commonMain, androidMain, iosMain, etc. But save Compose entrypoint to display something very simple. For example
Copy code
ComposeUIViewController {
    Text("Hello World")
}
• If error will be still presented - it is good for current step • Next, try to partially remove dependencies from build.gradle files. I hope in some step your project will compile and we can understand that's really brokes your build.
d
on it
removing everything and the bug is still present
Thank god, I found it
Dima, this was causing issues
Copy code
@OptIn(ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
Why and how I am really not sure. Do you maybe know why this would happen? Even if compose resources are transitively available in
1.6.0-rc02
, can it affect this? Anyways, removing explicit dependency fixes the issue. Also, just want to point out that
compose.components.resources
is not coming from my
.toml
file (or any versioning system) but rather from
org.jetbrains.compose
gradle plugin
@Dima Avdeev
d
Thanks! This is very usefull information!
If all sensitive code from your project is already removed. Can you create a reproducible sample on GitHub and attach it as a link to newly created Issue?
👍 1
d
I need to resolve something I am working on, will do it probably tommorow