• m

    Mananpoddarm

    2 years ago
    is it possible to use 3rd party libraries which are say platform specific? For example, tensorflow lite which is used in android/iOS. Iam including tensorflow lite as a dependency in jvmMain but I am not able to import it in my samplejvm.kt inside commonJVM module.
    m
    gildor
    +1
    14 replies
    Copy to Clipboard
  • felislynx

    felislynx

    2 years ago
    Hi, i would like to ask how to handle Coroutines on ios side. In my shared library api calls look like this
    fun apiCall() = GlobalScope.async(ApplicationDispatcher) {..}
    so in Android code i can do val returnValue = apiCall().await() how to handle same flow in iOS ? I see that return type for this function is
    Kotlinx_coroutines_coreDeferred
    but there is no await() function available
    felislynx
    1 replies
    Copy to Clipboard
  • Chetan Sachdeva

    Chetan Sachdeva

    2 years ago
    Has anyone tried integrating FCM in a KMP project? A reference implementation would help. Thanks in advance 🙂
    Chetan Sachdeva
    saket
    +1
    4 replies
    Copy to Clipboard
  • b

    bsimmons

    2 years ago
    Are there any gradle templates for building iosArm64 and iosX64 targets at the same time so that they can be publish to maven local as projectname-native? (Currently I keep switching between the two for testing and release.) I've looked at different build.gradle files from Okio, kotlinx.serialization, and read through the spec but I can't seem to figure this out how this works.
    b
    Kris Wong
    3 replies
    Copy to Clipboard
  • e

    esdudnik

    2 years ago
    Anybody know how to implement “timer” analog in multiplatform library?
    ticker
    (from kotlinx.coroutines.channels) are ony JVM based, and according to thishttps://github.com/Kotlin/kotlinx.coroutines/issues/540 I don’t see that they will be multiplatform
    e
    h
    3 replies
    Copy to Clipboard
  • Simon Schubert

    Simon Schubert

    2 years ago
    🤯 I tried to google and search this slack but my jvm and android mpp project won't run. Android builds fine but for the jvm I click the green arrow button in my Main.kt main() function and get the following error: "Error: Could not find or load main class sample.MainKt". Is there something wrong with my gradle? Simplified version:
    plugins {
        id 'org.jetbrains.kotlin.multiplatform'
    }
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'com.squareup.sqldelight'
    
    kotlin {
        android("android")
        jvm("jvm")
    
        sourceSets {
            androidMain {
                dependencies {
                    implementation kotlin('stdlib')
                    implementation "com.squareup.sqldelight:android-driver:1.3.0"
                }
            }
            jvmMain {
                dependencies {
                    implementation kotlin('stdlib')
                    implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
                    implementation "org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.1"
                }
            }
        }
    }
    Simon Schubert
    louiscad
    +2
    5 replies
    Copy to Clipboard
  • j

    janvladimirmostert

    2 years ago
    I'm trying out Kotlin Multiplatform for the first time, i've used the IntelliJ New Module to create a JVM/JS project What is the correct way to add a new npm dependency that does have TypeScript support should i just add it in the jsMain in build.gradle
    jsMain {
                dependencies {
                    implementation kotlin('stdlib-js')
                    implementation npm('lit-html', '1.2.1')
                }
            }
    or should i rather do
    mkdir lit-html-kt
    cd lit-html-kt
    npm init -y || exit
    sudo npm install -g dukat || exit
    npm install lit-html || exit
    dukat node_modules/lit-html/lit-html.d.ts || exit
    
    rm -rf ./*.json || exit
    rm -rf ./node_modules || exit
    which then generates kotlin files for this npm package ?
    j
    j
    2 replies
    Copy to Clipboard
  • aiidziis

    aiidziis

    2 years ago
    Hey! Currently in MPP we are using SqlDelight and coroutines to insert data into db:
    class DbHelper(db: Db) {
        suspend fun insert(elements: List<Element>) = withContext(Dispatchers.Default) {
            db.elementQueries.transaction {
                db.elementQueries.insert(.....)
            }
        }
    }
    This works fine when elements list is not too big, but now we encountered use case where we need to insert larger amount of data (in worst case insert is 1200ms), and now this same approach is causing problems on iOS because this all happens on Main Thread(async) , and while the data is inserting UI is getting blocked when user interacts with UI (scrolling). Is there a way with current coroutines versions
    "1.3.5-native-mt"
    to improve this? afaik with current coroutines version it is not possible move insert to Background Thread?
    aiidziis
    louiscad
    +1
    7 replies
    Copy to Clipboard
  • Matt Kranzler

    Matt Kranzler

    2 years ago
    Hello, I'm just getting started with KMP and I'm using the KaMP kit to boostrap a project. I'm having issues with Intellij (2020.1.2) locking up any time I try to debug a unit test. If I run the test it will execute fine but as soon as I try to debug it will lock up Intellij completely and I have to force quit. I also tried Android Studio 4.0 and have the same issue. Has anyone else experienced this?
    Matt Kranzler
    russhwolf
    2 replies
    Copy to Clipboard
  • John O'Reilly

    John O'Reilly

    2 years ago
    Should there be a version of Kotlinx Coroutines (and in particular one that supports native multithreading) available yet that works with Kotlin 1.4-M2? (I guess most KMP projects are probably blocked from using it right now anyway until various other libraries are released that work with that version)
    John O'Reilly
    Kris Wong
    +3
    14 replies
    Copy to Clipboard