Thread
#multiplatform
    Cicero

    Cicero

    1 year ago
    A library right I was wondering about this. In the past when my project was going to happen in React Native I wrote a node library for connectivity and models Is it similar to a node library? Could I also export my network from common as a library? Also brings me to another question, would I to be able to work in my common without having all this android stuff around? I would like to, for example, run my common independently.
    s

    Sam

    1 year ago
    Common is like an abstract class. It needs a target platform to run. If you want a lightweight platform without needing anything special to run tests, try adding a jvm platform. In my project I have jvm, Android and iOS platforms. The expect/actual classes in the jvm target are stubbed out just enough to make the tests pass.
    Cicero

    Cicero

    1 year ago
    Interesting, any suggestions of where I can see something like this working? Or a tutorial of some sort on “how to basic”?
    s

    Sam

    1 year ago
    No tutorials that I know of other than basic KMM stuff. To add a jvm target just specify it in your gradle file and add a
    jvmMain/kotlin/com.myproj
    and
    jvmTest/kotlin/com.myproj
    folder structure in the same folder that has your common and android folders. Here’s the part of my gradle file with the jvm target using kts.
    kotlin {
        jvm()
        android()
    You can invoke it from the command line with
    ./gradlew mymodule:jvmTest
    or through IntelliJ