• m

    mike.holler

    1 year ago
    I've been working with Kotlin/JS and Ktor's HTTP client, and although my tests pass in JVM and native, they fail for JavaScript. The reason why is cryptic. If it helps, I'm using the IR compiler and targeting the NodeJS runtime. Is there any way to get better error messages for something like this?
    Error_0: Fail to fetch
    Error_0: Fail to fetch
    	at _no_name_provided__246.invoke_1ti8hr(kotlin/multiplatform-sdk-end-to-end-tests-test.js:69724)
    	at <global>.<unknown>(/home/mjholler/Git/multiplatform-sdk/build/js/packages/multiplatform-sdk-end-to-end-tests-test/kotlin/multiplatform-sdk-end-to-end-tests-test.js:69752)
    	at <global>.processTicksAndRejections(internal/process/task_queues.js:93)
    m
    Big Chungus
    +1
    8 replies
    Copy to Clipboard
  • Ngenge Senior

    Ngenge Senior

    1 year ago
    Hello all. I happen to be migrating my Jetpack Compose code to Kotlin Multiplatform since I want to reuse part of the common code in SwiftUI. I have followed all the necessary instructions given at the following URL,https://kotlinlang.org/docs/mobile/integrate-in-existing-app.html#use-the-shared-module-from-swift after creating a shared module and created a fresh Xcode project in the same directory as the android app and shared module but when I build the XCode project, it keeps failing. The log is found here,https://gist.github.com/ngengesenior/bbdf12ee129bb12427cf25bc6b78ce3b . I really need some help as it is my first time creating a kmm project
    Ngenge Senior
    t
    4 replies
    Copy to Clipboard
  • f

    Fanis Paschos

    1 year ago
    Hello everyone. I have a KMM project and when I try to run the gradle task to create the iOS Framework, it fails with error: “e: java.lang.AssertionError: Unbound symbols not allowed Unbound public symbol for public kotlinx.serialization.json.internal/StreamingJsonDecoder.decodeNullableSerializableElement|7091057077819363828[0] public kotlinx.serialization.json.internal/StreamingJsonDecoder.decodeNullableSerializableElement|7091057077819363828[0] e: Compilation failed: Unbound symbols not allowed” Any ideas what might be the issue here? *Full error snippet in comments
    f
    1 replies
    Copy to Clipboard
  • c

    Cdev

    1 year ago
    Does anyone know how to make an XCFramework build that works for iosArm32 as well as iosArm64 and iosX64? I have my xcframework build working great with iosArm64 and iosX64 together, but when I try to add in iosArm32 I get a build error of "KotlinTarget with name 'iosArm32 not found"
    val buildXcFramework by tasks.registering {
        dependsOn("deleteXcFramework")
        group = "build"
        val mode = "Release"
        val frameworks = arrayOf("iosArm64", "iosX64", "iosArm32")
            .map { kotlin.targets.getByName<KotlinNativeTarget>(it).binaries.getFramework(mode) }
        inputs.property("mode", mode)
        dependsOn(frameworks.map { it.linkTask })
        doLast { buildXcFramework(frameworks) }
    }
    c
    Trevor Stone
    14 replies
    Copy to Clipboard
  • Raul Macías

    Raul Macías

    1 year ago
    Hello, how can i connect to firestore from the shared module?
    Raul Macías
    Mayank
    4 replies
    Copy to Clipboard
  • Kareem Waleed

    Kareem Waleed

    1 year ago
    Hello, any ideas when to expect
    KMM
    to be stable and ready for production ?
    Kareem Waleed
    Colton Idle
    +4
    7 replies
    Copy to Clipboard
  • Akram Bensalem

    Akram Bensalem

    1 year ago
    Yesterday they announced that "compose multiplatform" reach alpha stage. I retry for the second time to creat a project that work on "Android, desktop and Web" after updating plugin to alpha in IntilijIdea But unfortunately I had problem in both Android and Desktop parts (just the web that worked correctly). ... The problem with the Desktop is "MainKT is not found" And the problem with Android is that Compose libraries are not known. ... So my question is there any one who can teach me how to start a project that work on the 3 platform ?! Because It's obvious that the project that initialise in the default is not working or it missing something that I'm not able to figure out !!! Any help please
    Akram Bensalem
    gildor
    +1
    7 replies
    Copy to Clipboard
  • m

    Marko Novakovic

    1 year ago
    when I create multiplatform project in Intellij IDEA and I try to run desktop app nothing happens. any suggestions?
    m
    Colton Idle
    +1
    11 replies
    Copy to Clipboard
  • c

    Cdev

    1 year ago
    import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
    
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization")
        id("com.android.library")
    }
    
    val iOSProjectName = "MBKMMShared"
    val xcFrameworkPath = "xcframework/" + iOSProjectName + ".xcframework"
    
    tasks.create<Delete>("deleteXcFramework") { delete = setOf(xcFrameworkPath) }
    
    
    
    kotlin {
        val serializationVersion = "1.1.0"
        val koTestVersion = "4.4.3"
    
        android()
    
        iosArm32()
    
        ios {
            binaries {
                framework {
                    baseName = "MBKMMShared"
                }
            }
        }
    
        sourceSets {
            val commonMain by getting {
                dependencies {
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
                }
            }
            val commonTest by getting {
                dependencies {
                    implementation(kotlin("test-common"))
                    implementation(kotlin("test-annotations-common"))
                    implementation("io.kotest:kotest-property:$koTestVersion")
                    implementation("io.kotest:kotest-assertions-core:$koTestVersion")
                }
            }
            val androidMain by getting
            val androidTest by getting {
                dependencies {
                    implementation(kotlin("test-junit"))
                    implementation("junit:junit:4.13")
                }
            }
            //val iosMain by getting
            val iosTest by getting
    
            val iosX64Main by sourceSets.getting
            val iosArm64Main by sourceSets.getting
            val iosArm32Main by sourceSets.getting
    
            val iosMain by sourceSets.getting {
                dependsOn(commonMain)
                iosX64Main.dependsOn(this)
                iosArm64Main.dependsOn(this)
                iosArm32Main.dependsOn(this)
            }
        }
    }
    
    android {
        compileSdkVersion(30)
        defaultConfig {
            minSdkVersion(21)
            targetSdkVersion(30)
        }
        sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    }
    
    val packForXcode by tasks.creating(Sync::class) {
        group = "build"
        val mode = System.getenv("CONFIGURATION") ?: "RELEASE" // TODO Fix before release
        val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
        val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
        val framework =
            kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
    
        inputs.property("mode", mode)
        dependsOn(framework.linkTask)
        val targetDir = File(projectDir, "xcode-frameworks")
        from({ framework.outputDirectory })
        into(targetDir)
    }
    tasks.getByName("build").dependsOn(packForXcode)
    
    
    
    
    fun Task.buildXcFramework(frameworks: List<org.jetbrains.kotlin.gradle.plugin.mpp.Framework>) {
        val buildArgs: () -> List<String> = {
            val arguments = mutableListOf("-create-xcframework")
            frameworks.forEach {
                arguments += "-framework"
                arguments += "${it.outputDirectory}/" + iOSProjectName + ".framework"
            }
            arguments += "-output"
            arguments += xcFrameworkPath
            arguments
        }
        exec {
            executable = "xcodebuild"
            args = buildArgs()
        }
    }
    
    val buildXcFramework by tasks.registering {
        dependsOn("deleteXcFramework")
        group = "build"
        val mode = "Release"
        val frameworks = arrayOf("iosArm32", "iosArm64", "iosX64")
            .map { kotlin.targets.getByName<KotlinNativeTarget>(it).binaries.getFramework(mode) }
        inputs.property("mode", mode)
        dependsOn(frameworks.map { it.linkTask })
        doLast { buildXcFramework(frameworks) }
    }
    c
    1 replies
    Copy to Clipboard
  • a

    Alexandru Caraus

    1 year ago
    Is it possible to split the multiplatform code, to have multiple modules?
    a
    c
    7 replies
    Copy to Clipboard