• m

    Marc Knaup

    1 year ago
    Does anybody know how to get around this error?
    Initialization script ‘/private/var/folders/wp/jsq85rms0tsf2h7x_9kqfztr0000gn/T/MigrationKt_main__.gradle’ line: 27
    Could not create task ‘
    :raptor:MigrationKt.main()’.
    > Could not get unknown property ‘sourceSets’ for project ‘:raptor’ of type org.gradle.api.Project.
    It’s when I run a
    main
    function from IDE. The project is a JVM project and depends on a multi-module multiplatform library (
    raptor
    ) which is an included Gradle build. Here’s the offending code generated by the IDE (the
    else
    branch):
    m
    2 replies
    Copy to Clipboard
  • m

    mike.holler

    1 year ago
    In Kotlin JVM,
    .kt
    and
    .java
    files can exist side-by-side in the file system and you can access Kotlin functions from the Java file and vice versa. Are there any examples of doing that with JS? I'm talking within the same source set and file structure. I can't seem to figure it out.
    m
    Big Chungus
    +1
    13 replies
    Copy to Clipboard
  • m

    mike.holler

    1 year ago
    I have a Kotlin Multiplatform library I'm trying to use from
    .js
    as a npm package. I can call normal functions just fine in JS, but
    suspend
    functions are a bit of an enigma from the
    .js
    side. I know I can create a wrapper in
    jsMain
    but I'd rather not manually do that for every suspend function. Is there any way to call a suspend function in JS and get a promise back (even if it requires a little helper function?) Here is a modified version of the Base64 library example to show what I'm trying to do. Kotlin Implementation
    interface Base64Encoder {
        @JsName("encode")
        fun encode(src: ByteArray): ByteArray
    
        @JsName("encodeToString")
        fun encodeToString(src: ByteArray): String {
            return encode(src).let { encoded ->
                buildString(encoded.size) {
                    encoded.forEach { append(it.toChar()) }
                }
            }
        }
    
        suspend fun downloadAndEncodeToString(url: String): String {
            return HttpClient().use {
                it.get<HttpResponse>(url = Url(url)).readText()
            }
        }
    }
    JS Usage (see image below)
    m
    1 replies
    Copy to Clipboard
  • Mustafa Ozhan

    Mustafa Ozhan

    1 year ago
    Hello guys, I have a question, I created project with standart Android Studio KMM plugin. And then I added also my
    backend
    module into project as
    jvm
    target but surprisingly backend Module is not seeing
    commonJvm
    rather it sees
    commonAndroid
    expected values. Also I can not reach the class in
    commonMain
    from
    backend
    module. Did anyone had similar issue ? You can see the gradle.kts files in thread
    Mustafa Ozhan
    Ali Albaali
    +2
    26 replies
    Copy to Clipboard
  • Mikołaj Kąkol

    Mikołaj Kąkol

    1 year ago
    Hi, it seams that
    MutableStateFlow
    is not suitable for MPP when multi-threading, since it will be frozen and crash. Any good replacement or knowledge if it will work eventually? My case is that I would like on Native (iOS) watch for value changes and be able to notify kotlin code when Native would like to change value. It's would be okay to have two fields, one for reading and second for writing.
    Mikołaj Kąkol
    t
    2 replies
    Copy to Clipboard
  • Brady Aiello

    Brady Aiello

    1 year ago
    For iOS KMP, are the generated methods shorter when invoking from Swift than from Obj-C?
    Brady Aiello
    a
    2 replies
    Copy to Clipboard
  • c

    Christian Sousa

    1 year ago
    Hey guys, I’m investigating for the company I work for if we can upgrade to Kotlin 1.4 (we are using Kotlin 1.3.70 right now), but when updating for 1.4.10 or even 1.4.20-M1 I get the following on iOS (we are building a multiplatform project):
    Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    Does anyone knows what might be causing this? This is not happening on our current implementation using 1.3.70, so it might be something that might’ve changed in this new release. Any help would be really nice! Thanks in advance!
    c
    aleksey.tomin
    4 replies
    Copy to Clipboard
  • g

    georg

    1 year ago
    Hey everyone, I created a Gradle plugin that generates an XCFramework and a Package.swift file so that you can distribute your multiplatform library as a binary target for Apple platforms. You can find all the details on Github. Please give it a shot and let me know what you think. Looking forward for your feedback.https://github.com/ge-org/multiplatform-swiftpackage
    g
    k
    4 replies
    Copy to Clipboard
  • Sebouh Aguehian

    Sebouh Aguehian

    1 year ago
    I’m testing the just released Android Studio KMM plugin (0.1.3-release-54-Studio4.0). The announcement article says:
    For both the application and tests you can set breakpoints and debug your code on iOS.
    I created a new project and added a single iOS test in the shared module. Stopping on breakpoints isn’t working.
    import kotlin.test.Test
    import kotlin.test.assertTrue
    
    class IosTest {
        @Test
        fun test() {
            assertTrue(false) // breakpoint here
        }
    }
    Sebouh Aguehian
    Konstantin Tskhovrebov
    +1
    6 replies
    Copy to Clipboard
  • p

    peekandpoke

    1 year ago
    Hi there! I have a problem that I have spent mutliple hours on now, but I could not find a solution. So we have this situation: We are using a multiplatform library, which is published through bintray. On my machine everything works fine. On my colleagues machine it does not. One curious thing is the following. On my machine i can see in IntelliJ that all dependencies are loaded, especially the "commonmp-metadata" ... Please compare the two screenshot I attached. On my colleagues machine this some does not seem to be fetched properly and therefore things do not compile. He sees lot's of errors of unresolved symbols in the IDE while I do not. Basically non of the packages and classses from the library are recognized. What is even more strange is that "./gradlew build" does work for him, but "./gradlew assemble" does not. When running assemble the failing gradle task is "compileKotlinMetadata" on the subproject using the multiplatform lib. We have tried to see what is different in the setups of our systems. Java version 1..8.0_265 is the same. Nodejs 10.19.0 is the same. Npm 6.14.4 is the same. The only difference we can spot is that I am running Pop!Os and he runs Ubuntu. Another colleague with Ubuntu has the same issue by the way. Sooooo... long text. Does anyone have an idea what to look for? Thanks a lot.
    p
    mbonnin
    15 replies
    Copy to Clipboard