msa1422 / KMM-Arch-PetSearch

Kotlin-Multiplatform Mobile app which connects to PetFinder Api and let's you browse adorable pets.
MIT License
19 stars 0 forks source link

Value of type 'MessageDeque' has no member 'invokeNative' #4

Closed rezafaraji93 closed 1 year ago

rezafaraji93 commented 1 year ago

I created sample project like your project. After run ios app in ContentView.swift: **

Screenshot 1402-02-06 at 13 05 47

**

Value of type 'MessageDeque' has no member 'invokeNative'

shared gradle :

@file:Suppress("DSL_SCOPE_VIOLATION")

plugins {
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
    kotlin("plugin.serialization").version("1.8.20")
    id("com.google.devtools.ksp").version("1.8.10-1.0.9")
    id("com.rickclephas.kmp.nativecoroutines").version("1.0.0-ALPHA-5")
    id("dev.icerock.mobile.multiplatform-resources").version("0.21.1")
}

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("../iosImpFinance/Podfile")
        framework {
            baseName = "sharedImpFinance"

            export("dev.icerock.moko:resources:0.21.1")
            export("dev.icerock.moko:graphics:0.9.0") // toUIColor here
        }
    }

    sourceSets {
        val ktorVersion = "2.2.4"
        val commonMain by getting {
            dependencies {
                //core
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")

                //util
                implementation("com.squareup.okio:okio:3.3.0")
                implementation("io.insert-koin:koin-core:3.4.0")
                api("io.github.kuuuurt:multiplatform-paging:0.6.2")
                api("co.touchlab:kermit:1.2.2")
                implementation("com.benasher44:uuid:0.7.0")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")

                //ktor
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-logging:$ktorVersion")
                implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")

                implementation("com.russhwolf:multiplatform-settings:1.0.0")
                implementation("com.russhwolf:multiplatform-settings-coroutines:1.0.0")

                implementation("com.russhwolf:multiplatform-settings-no-arg:1.0.0")

                //resource
                api("dev.icerock.moko:resources:0.21.1")
                //api("dev.icerock.moko:resources-compose:0.20.1") // for compose multiplatform
                //testImplementation("dev.icerock.moko:resources-test:0.21.1")
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting {
            dependencies {
                implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
                implementation("io.ktor:ktor-client-android:$ktorVersion")
                implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
                implementation("io.insert-koin:koin-android:3.4.0")
            }
        }
        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)

            dependencies {
                implementation("io.ktor:ktor-client-darwin:$ktorVersion")
            }
        }
        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 = "---"
    compileSdk = 33
    defaultConfig {
        minSdk = 24
        targetSdk = 33
    }
}

multiplatformResources {
    multiplatformResourcesPackage = "---"
    multiplatformResourcesClassName = "MR"
    disableStaticFrameworkWarning = true
    //multiplatformResourcesVisibility = MRVisibility.Internal // optional, default Public
    //iosBaseLocalizationRegion = "en" // optional, default "en"
    //multiplatformResourcesSourceSet = "commonClientMain"  // optional, default "commonMain"

}
msa1422 commented 1 year ago

Issue lies in the KMP NativeCoroutines plugin id("com.rickclephas.kmp.nativecoroutines").version("1.0.0-ALPHA-5")

1.0.0-ALPHA versions work slightly different than the older versions (0.13.3 being used in the project). Newer versions require KSP plugin to work and they do not generate functions with Native suffix by default. Migration to newer version is still pending in PetSearch. I encourage you to check out the Readme of latest version of KMP-NativeCoroutines and modify your code accordingly.

msa1422 commented 1 year ago

I have updated the code with latest Moko-resources and KMP-NativeCoroutines. You can have a look.