https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • s

    Sam

    08/23/2020, 9:22 PM
    Hello everyone, Good day you guys, I’m researching about Kotlin / Native to build desktop and iOS apps So I want to ask about your experiences before presentation for my boss. 1. I want to build an desktop app for windows/macos, Can I use TornadoFX? or only Kotlin/Native is enough for build the app?. 2. How to create an Installer for Windows / MacOS ? ( like dmg or setup.exe) 3. Is it possible to use the Swift library (3rd) to integrate with Kotlin/Native? Thanks.
    a
    l
    • 3
    • 6
  • o

    Orhan Tozan

    08/24/2020, 11:53 AM
    Is this an unrevealed new library on top of Kotlin Multiplatform?
    😮 1
    👀 1
    o
    d
    m
    • 4
    • 3
  • d

    Daniele B

    08/24/2020, 12:11 PM
    This is what I think a typical app architecture will be. With third parties starting to release KMP libraries too.
    👍 9
    j
    • 2
    • 10
  • d

    dambakk

    08/25/2020, 6:29 AM
    To answer myself ☝️ , the issue is not sealed classes I believe but rather that
    kotlinNothing
    is not a sub-type of
    NSString
    . However, the situation above is an implementation of how this article suggests dealing with serializing nullable and optional properties which I think is overengineered. Instead of using the sealed class to represent the three states present-with-value, present-with-null-value, and not-present you can instead have a
    data class OptionalProperty<T>(val value: T)
    and use it as a nullable property type and still cover all the states. It works as before, but is now much more pleasant to use from swift. But please correct me if I’m wrong.
    p
    • 2
    • 3
  • j

    Jeff

    08/25/2020, 7:46 AM
    :kotlin: Hello! Little question. How do I structure a multiplatform library that is basically an API wrapper for a third-party payment service. The library can be used in Multiplatform projects, Android and JS. 1. Is it even necessary for the library to include View Model and Data Repository? 2. Also, is it best to use callbacks or pure suspend functions? Really appreciate your advice 🙂
    b
    c
    • 3
    • 6
  • m

    Mikołaj Kąkol

    08/25/2020, 9:21 AM
    Hi, I was wondering if anyone tried to publish, a MPP lib that is build on multiple machines. Use case is: • build osx lib on mac • build Android on Unix • maybe building something on Windows How do I combine artifacts from each machine to a single artifatory? Since there is this
    *.module
    file in main lib, that contains information about every platform and calling multiple time
    mavenPublish
    or sth similar would override that
    *.module
    file. So basically it comes to how to publish artifacts build on different platforms to a single lib?
    b
    m
    a
    • 4
    • 27
  • m

    Marc Knaup

    08/25/2020, 11:11 AM
    How do you deal with
    NSInteger
    in common Darwin code? 😮
    l
    j
    r
    • 4
    • 34
  • s

    Sebastien Leclerc Lavallee

    08/25/2020, 1:30 PM
    Hello! When I try to build, I get this error:
    Your current kotlinx.serialization core version is too low, while current Kotlin compiler plugin 1.4.0 requires at least 1.0-M1-SNAPSHOT. Please update your kotlinx.serialization runtime dependency.
    The problem is, I never updated to Kotlin 1.4. My Kotlin used for dependencies is 1.3.70. I did came across a warning yesterday that sais something like:
    Common module has an external compiler that use Kotlin 1.4
    Does that ring a bell to someone? The “only” thing I did was to update from gradle 5.6.X to 6.5, but I doubt it had that kind of repercussion. Thanks 🙂
    m
    • 2
    • 8
  • m

    Maurice Jouvet

    08/25/2020, 1:38 PM
    Hi, I am using KaMPKit and I have this issue when Building on iOS. Command PhaseScriptExecution failed with a nonzero exit code Do you know what is the pb?
    ➕ 1
    s
    k
    z
    • 4
    • 18
  • z

    zsperske

    08/25/2020, 6:21 PM
    Wondering if anyone has run into an issue like this when trying to build for a real iPhone target.
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_SharedCodeEventUiModel", referenced from: objc-class-ref in EventUI.o
    I assume I need to change my gradle setup but I'm unsure what exactly I need to change.
    y
    • 2
    • 12
  • s

    saket

    08/26/2020, 1:37 AM
    Would anyone understand what this error means?
    Execution failed for task 'compileKotlinIos':
    
    Compilation failed: Deserializer for declaration public kotlinx.coroutines/SingleThreadDispatcher|null[0] is not found
    b
    • 2
    • 4
  • b

    bughunter

    08/26/2020, 8:56 AM
    Hi, I need some help to implement a kafka consumer and producer for the js Part. I actually have no idea how to do this... Does somebody have an example?
    p
    • 2
    • 1
  • m

    Marc Knaup

    08/26/2020, 5:27 PM
    What kinds of libraries do you miss most in multiplatform?
    👍 2
    n
    a
    +7
    • 10
    • 34
  • z

    zsperske

    08/26/2020, 7:21 PM
    Does anyone have experience with compiling their KMP app into an iOS archive to upload to TestFlight? I packaged my shared code as a framework and included it in my iPhone target but when I try to build an archive for a Generic iOS Device, I end up getting a
    No such module 'SharedCode'
    error on my import statements
    k
    r
    y
    • 4
    • 18
  • i

    Ivann Ruiz

    08/26/2020, 7:46 PM
    Hi all 👋 starting a new MPP project using Kotlin 1.4, lemme pick your brains a bit. In my app's
    build.gradle.kts
    file I can create ios/android targets by adding these lines👇 it all compiles and runs fine.
    plugins {
        kotlin("multiplatform")
    }
    
    kotlin {
        ios()
        android()
    }
    but when i try to put this same logic in the
    build.gradle.kts
    of a new
    :common
    module it just won't work. First it gives me an error on the
    android()
    line. Second, i get around this by adding
    jvm("android")
    instead, but then my app crashes when running. The point of doing this is so I can have all the multiplatform gradle code separate from the app gradle. Thoughts?
    k
    k
    • 3
    • 7
  • g

    gumil

    08/26/2020, 8:01 PM
    Has anyone encountered IDE not being able to add Multiplatform dependency into a JVM project? I've tried it on IntelliJ IDEA 2020.2 and Android Studio 4.2 canary 7. Command line works fine but it's hard to work on a jvm module when IDE gives error on classes not being resolved from the multiplatform dependency
    ➕ 1
    j
    • 2
    • 2
  • u

    Uri Abad

    08/27/2020, 7:16 AM
    Hi guys! First comment here!!!😁 Do you have any workaround to be able to test coroutines in native enviroment?? I just had this workaround to make common test works against JVM, but I couldn't find any solution for native:
    //Common
    expect fun runBlockingAdapter(block: suspend () -> Unit)
    
    //JVM
    actual fun runBlockingAdapter(block: suspend () -> Unit) = kotlinx.coroutines.runBlocking { block() }
    
    //Native
    actual fun runBlockingAdapter(block: suspend () -> Unit) {
        throw UnsupportedOperationException()
    }
    m
    • 2
    • 2
  • l

    Larten

    08/27/2020, 12:35 PM
    Hi! We released our solution to multiplatform logging. Feel free to check it! (We are using in production 😎) https://github.com/FitPuli/abele
    a
    a
    • 3
    • 9
  • m

    Maurice Jouvet

    08/27/2020, 1:27 PM
    I have a weird issue: Task 'generateAndroidDebugDatabaseInterface'. Is given me this:
    k
    s
    • 3
    • 17
  • a

    audax

    08/27/2020, 2:24 PM
    I have a kotlin multiplatform project with jvm and js targets. How do I build junit-xml test reports for my js and jvm tests?
    b
    • 2
    • 1
  • a

    Artem Kopan

    08/27/2020, 8:23 PM
    I have issue with kotlin 1.4 and android studio 4.2 canary 8. I added android() target but AS doesn’t see it. androidMain folder is not marked as source set, creating ‘actual’ pop-up is not appeared for android. But, If I try to compile project everything works fine
    plugins {
        id "org.jetbrains.kotlin.multiplatform"
        id("com.android.library")
    }
    
    android {
        compileSdkVersion(29)
        defaultConfig {
            minSdkVersion(19)
            targetSdkVersion(29)
        }
        sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    }
    
    kotlin {
    
        android()
        iosX64("ios")
    
    }
    👆 2
    i
    r
    • 3
    • 5
  • l

    louiscad

    08/28/2020, 8:00 AM
    Hello, I'm advertising the #library-development channel that we have on this Slack. We can use it to chat about our pain points and solutions as library developers (like overcoming the 405/409 http errors from bintray that make publishing workflows flaky 😬). If you make libraries or plan to do it, consider joining that channel!
    m
    a
    • 3
    • 52
  • s

    Seyed Jafari

    08/28/2020, 9:44 AM
    Hi all, I have ported my Android project to KMP. I got one question about common code. when ever I move any of my code to
    commonMain
    other modules can not resolve that code correctly. so some functions will turn red and the ide will not help with compilation. the worst part is I can not use
    cmd + b
    to see the declaration, because it takes me the compiled code. All these unresolved codes are ok when I run/compile the App. Touchlab Kamp starter has the same problem too
    Bread
    is not resolved but project can be run (check image). is there any fix I can apply to resolve this issue? ‌Bread is missing.jpg
    ➕ 2
    s
    m
    +2
    • 5
    • 11
  • s

    ShawnV

    08/28/2020, 8:16 PM
    So I posted this in #kotlin-native but this might be a question for #multiplatform
    • 1
    • 1
  • g

    Gunslingor

    08/30/2020, 12:19 AM
    So in mpp, all content change happen in the frontend right, the server is just queried for data and front end back end are pretty isolated right? So onclick, change content with server data... typically, to change pages. So how does one change the url, and if someone enters an url they expect to see how do I tell the server to display that page. I'm also confused how the login page works... I get the impression it should be entirely defined in the ktor backend, not even the template should be in the front end is, is that right? Guess I'm confused about the handoff between front and backend
    r
    • 2
    • 13
  • s

    saket

    08/30/2020, 4:56 AM
    Is there any way to capture a throwable’s stacktrace in common code?
    r
    • 2
    • 2
  • a

    AG

    08/30/2020, 4:30 PM
    Hi everyone I’m trying to create kmp with ktor 1.4.0 similar to this sample https://github.com/ktorio/ktor-samples/tree/master/client-mpp and having issues with ktor, ios app keep crashing with kotlin
    InvalidMutabilityException
    class Api {
    
        private val client = HttpClient()
    
        var address = Url("<https://tools.ietf.org/rfc/rfc1866.txt>")
    
        fun request(callback: (String) -> Unit) {
            GlobalScope.apply {
                launch(ApplicationDispatcher) {
                    val result: String = client.get {
                        url(address.toString())
                    }
                    callback(result)
                }
            }
        }
    }
    j
    r
    • 3
    • 14
  • i

    Ivann Ruiz

    08/30/2020, 5:20 PM
    Something neat that's helping my project structure is renaming
    app
    directory to
    android
    so it's more clear when working with KMP. All you have to do is rename the folder with
    Shift + F6
    , and go to
    settings.gradle.kts
    and change the include string from
    app
    to
    android
    .
    👍 4
    s
    • 2
    • 2
  • z

    zsperske

    08/30/2020, 11:26 PM
    Does anyone have experience with or examples of writing UI tests for iOS in Kotlin in your
    iosTest
    package? Or do people usually write their iOS UI tests in swift?
    i
    • 2
    • 2
  • h

    Hyun

    08/31/2020, 12:29 AM
    Hi, I’m migrating multiplatform project to 1.4 version and when sync project with gradle file on Android Studio 4.2 Canary 8 the attached
    Gradle import errors
    shows. syncing is success and build also success. but, Android Studio doesn’t recognize classes or functions so, I assume that the
    Gradle import errors
    may be related to the problem Is there any thing I can try? Kindly let me know if further information is required. my project contains the below • android Jetpack compose • multiplatform module use multipltform library, • Ktor, Ktor client • Sqldelight • coroutine mt
    Untitled
    j
    k
    • 3
    • 5
Powered by Linen
Title
h

Hyun

08/31/2020, 12:29 AM
Hi, I’m migrating multiplatform project to 1.4 version and when sync project with gradle file on Android Studio 4.2 Canary 8 the attached
Gradle import errors
shows. syncing is success and build also success. but, Android Studio doesn’t recognize classes or functions so, I assume that the
Gradle import errors
may be related to the problem Is there any thing I can try? Kindly let me know if further information is required. my project contains the below • android Jetpack compose • multiplatform module use multipltform library, • Ktor, Ktor client • Sqldelight • coroutine mt
Untitled
classes not recognized like the screenshot
There is multiplatform module which depends on multiplatform library. multiplatform library contains dependency like attatched snippet (used
api
configuration) and multiplatform module doesn’t contains
kotlin-coroutines-core
as library already contains. so, when I added
kotlin-coroutines-core
on multiplatform module, it’s working fine to recognize classes but, I think it should work when dependency exist in the multiplatform library, even if the dependency doesn’t exist in the multiplatform module it’s not related to
kotlin-coroutines-core
, when I tested, other dependencies also have some problem. it seems related to
api
configuration
Untitled
j

Jeff

08/31/2020, 5:12 AM
I migrated too and now all the code in my
build.gradle.kts
files are highlighted in red although things seem to work correctly :/
😥 1
k

Konstantin Tskhovrebov

09/03/2020, 12:34 PM
Try to add kotlinx-coroutines-core:1.3.9*-native-mt* to dependencies.
h

Hyun

09/03/2020, 8:41 PM
Thanks for suggestion. I’m using native-mt. but still same issue. for workaround, I copied same dependency from library to module.
View count: 4