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
  • k

    Kurt Renzo Acosta

    11/28/2019, 3:24 AM
    Anyone having an issue on building an iOS framework on 1.3.60? Having this issue:
    e: java.lang.IllegalStateException: Could not find serialized descriptor for index: -6614713790654178244 kotlinx.coroutines.internal,<root>,SharedImmutable
    r
    s
    • 3
    • 7
  • k

    Konstantin Petrukhnov

    11/28/2019, 6:59 AM
    Trying to tun ios test from: https://github.com/Kotlin/mpp-example/blob/master/greeting/build.gradle got error: Process 'command 'xcrun'' finished with non-zero exit value 111 I could run other projects from xcode or IDEA in 'iPhone 8' simulator
    t
    • 2
    • 4
  • r

    Ran

    11/28/2019, 10:00 AM
    I just reopen my project and kotlin dsl cannot be resolved, and the relevant items are highlighted like the picture shows
    s
    • 2
    • 3
  • r

    Ran

    11/28/2019, 10:02 AM
    I use IDEA 2019.2.4 and kotlin version is 1.3.50.
    i
    e
    +2
    • 5
    • 9
  • m

    Maurice Jouvet

    11/28/2019, 12:54 PM
    I am looking to create an entity on both platform. Simple one User with an id and a name. I created an expect class User { var id: Long, var name: String } And on Android the actual is using RealmObject (which works fine) I wanted to use the same on iOS. But here I’m stuck. How can I achieve that? Can I use Realm directly with Kotlin for iOS or is it impossible?
    m
    a
    +2
    • 5
    • 14
  • c

    Cristián Arenas

    11/28/2019, 3:55 PM
    How can I
    embedBitcode
    in a
    staticLib
    ? I can do it if I output a
    framework
    , but I can’t get it to work on a static library.
    • 1
    • 1
  • j

    Joey

    11/29/2019, 7:19 AM
    Does multiplatform library have the access to run background tasks for android and iOS? Sample use case is to monitor their location even app is in the background. Thanks in advance!
    o
    • 2
    • 7
  • m

    mbonnin

    11/30/2019, 10:23 AM
    How does producing a framework from modules with api dependencies work ? I have this:
    //mpp-module-1/build.gradle
    kotlin {
        macosX64 {
            binaries {
                framework()
            }
        }
        sourceSets {
            val commonMain by getting {
                dependencies {
                    api(project(":mpp-module-2"))
                }
            }
        }
    }
    And it looks like the classes from
    mpp-module-2
    are not exported in the .framework ? Is that expected ?
    y
    • 2
    • 5
  • p

    Piasy

    12/01/2019, 3:55 AM
    How could I implement the message queue programming pattern in mpp? “message queue programming pattern” means: an object, let’s call it
    Counter
    , provides some operations, e.g.
    increase
    and
    decrease
    , these operations could be called from main thread or other worker threads, but
    Counter
    will schedule these calls into its own single threaded message queue, then change its state, e.g. the
    count
    , it may also output its state through some callback, and the callback should be invoked on main thread. On Android, we could using Handler or Executor to implement this pattern easily, I’m thinking if it’s possible to do it on Kotlin/Native. I want to develop a Kotlin multiplatform app and want to use this pattern in it. I tried
    worker
    , but everything submitted to worker must be frozen, so I can’t update
    Counter
    ’s state. I also tried
    coroutine
    , but on Kotlin/Native, coroutine only works for main thread, although there is a preview version supporting multi-thread coroutine, but when I try to launch a coroutine on the dispatcher created by
    newSingleThreadContext("test")
    , it fails with “This dispatcher can be used only from a single thread test, but now in MainThread”.
    o
    • 2
    • 6
  • s

    spierce7

    12/01/2019, 4:39 AM
    Was Heirarchical Multiplatform Projects released with 1.3.60? I don’t see anything in the release notes about it.
    b
    l
    +3
    • 6
    • 22
  • h

    Hannes

    12/01/2019, 7:31 PM
    Hi, I'm new to kotlin multiplatform and I want to create a multiplatform library using coroutines and
    Flow
    . Is there any material how to get started with that? I looked into existing multiplaform libraries configs on github and copied most
    build.gradle
    config but I get a lot of
    unresolved reference
    errors while compiling:
    library/src/commonMain/kotlin/com/freeletics/flowredux/FlowRedux.kt: (7, 32): Unresolved reference: Flow
    l
    m
    • 3
    • 9
  • j

    Joey

    12/02/2019, 1:38 AM
    Can someone give me technique on how to listen for button state (android/iOS) in common code?
    s
    m
    +2
    • 5
    • 11
  • j

    JoakimForslund

    12/02/2019, 1:36 PM
    Question, I'm using Kotlin Multiplatform 1.3.50. I'm trying to move away from running android in a multiplatform-library under the folder
    main
    into
    androidMain
    I've added this onto the android-library extension:
    sourceSets.forEach {
            val root = "src/androidMain/${it.name}"
            val manifestFile = file("src/androidMain/AndroidManifest.xml")
            it.setRoot(root)
            it.java.setSrcDirs(fileTree("${root}/kotlin"))
            it.manifest.srcFile(manifestFile)
        }
    which seems to at least make everything look in the right place. However, now my
    expect/actual
    in my common starts to complain that it can not find the actual implementation for jvm set up, which is weird, because I have not setup a target for jvm, and the implementation it should be looking for, does exist within the
    androidMain
    folder, but it does not look for it there, how can I change that?
    s
    • 2
    • 8
  • e

    egorand

    12/03/2019, 10:25 AM
    I’ve bumped a multiplatform library to 1.3.60 and
    jsNodeTest
    started failing with the following message:
    Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
    I’m completely fine with the tests taking longer than 2s in this case, are there any configuration options that would allow ignoring this error?
    i
    • 2
    • 2
  • f

    Fabio Bombardi

    12/03/2019, 10:43 AM
    Dumb question. With this simple kotlin-mpp template https://github.com/shadowsheep1/kotlin-mpp-playground if I switch to Android visualisation I cannot see
    androidMain
    and
    androidTest
    folders. Any ideas of the reason I cannot see them?
    s
    k
    • 3
    • 9
  • m

    Max Raskin

    12/03/2019, 6:12 PM
    Hi, in a Kotlin MPP, is there a clean way of serializing a Map<String, Any> to a JSON string? I've tried doing it using kotlinx.serialization but it seems to support only classes annotated with @Serializable, am I missing something? Thanks 🙂
    b
    • 2
    • 1
  • d

    Dmitri Sh

    12/04/2019, 4:05 AM
    with an expected class in shared, not possible to have any method implementation? All methods must be actualized in platform specific actuals? I have a class (decorator) that can have some of its methods actually implemented in shared - but am forced to duplicate the code in actuals. Is this (no pun intended) "expected"? Seems like a waste.
    k
    • 2
    • 2
  • j

    Joey

    12/04/2019, 7:10 AM
    How to publish shared library / multiplatform library in jitpack?
    k
    a
    • 3
    • 2
  • m

    msink

    12/04/2019, 7:54 AM
    I'm lost in generic expect/actual common:
    expect class WeakReference<T>(instance: T) {
        fun get(): T?
    }
    jvm:
    actual typealias WeakReference<T> = java.lang.ref.WeakReference<T>
    native:
    actual typealias WeakReference<T> = kotlin.native.ref.WeakReference<T>
    jvm works, native fails with message "The following declaration is incompatible because upper bounds of type parameters are different: public actual typealias WeakReference<T> = WeakReference<T>" What it wants?
    j
    t
    • 3
    • 4
  • j

    Joey

    12/04/2019, 8:56 AM
    Im having this log when building my library in jitpack. Cant find any solutions online. Anyone encountered this?
    • 1
    • 1
  • s

    StefMa

    12/04/2019, 10:30 AM
    Why isn’t there a common “Throws” annotation? As I see it correctly, Kotlin/Native has a Throws and Kotlin/JVM has Throws. Only the JS world don’t have it. But this could be a simply annotation which simply does nothing, right? Or are there any other concerns why it should not be available in common?
    a
    • 2
    • 1
  • y

    yshrsmz

    12/04/2019, 10:44 AM
    https://github.com/JetBrains/kotlinconf-app/blob/d56c3383d52dfdc32ba449d8daf9b9f633dd1d08/iosApp/iosApp/Controllers/HomeController.swift While looking at the KotlinConf app's code, I see iOS does not handle Closeables returned from CFlow. I wonder why.
    c
    • 2
    • 3
  • m

    Maurice Jouvet

    12/04/2019, 2:13 PM
    Hi, I don’t know if you have the same problems as me, but I am struggling a lot to find a good starter project with testing. I was looking to get our Kotlin app to MPP, in order to have iOS support. The refactoring part, is done with clean architecture and TDD. But for the MPP, there is always something not working correctly. Intellij is always saying something is failing, and so on with the dependencies... I tried so many times.. I Started with the kotlinconf-app, but there are too many differents ways on the web, I couldn’t find a great project for this. My superior is now thinking about Flutter, if you could give me some advices? Or a really good place to start? I am missing a good understanding of how the gradle projects, modules are fitting together. Thanks in advance.
    m
    t
    r
    • 4
    • 14
  • s

    Sylvain Patenaude

    12/04/2019, 4:29 PM
    In .NET for instance, a method like
    byte[] BitConverter.GetBytes(Int32)
    will preserve the computer architecture byte order (big-endian or little-endian). Is there some equivalent (keeping the proper byte order) to this method in Kotlin? NOTE: It is to be used in a Kotlin multiplatform context.
    k
    b
    • 3
    • 12
  • s

    Sylvain Patenaude

    12/04/2019, 5:53 PM
    Dumb quick question: can we implement an extension method with the
    expect
    /
    actual
    pattern? EDIT: Looks like it's doable, but the method I want to split is not an extension method after all. So my question is rather: Can we have only some methods of a class that are prefixed with
    expect
    or does it have to be the full class at that point? For instance, I would have a class where pretty much all methods would be 'common' except for a few that would need to be implemented natively.
    r
    d
    a
    • 4
    • 31
  • d

    darkmoon_uk

    12/05/2019, 12:18 AM
    Publishing a Multi-platform library is a dream thanks to the plugin's integration with the Gradle/Maven Publishing API's. ✔️ ❓ But how would I add one of my test source sets, to also be published, as a separate jar 🤔
    k
    • 2
    • 2
  • i

    ian.shaun.thomas

    12/05/2019, 6:16 PM
    you can watch everything here https://kotlinconf.com/ it's youtube so you can just rewind through the live streams, not a great experience but it works just fine until they get the videos cut and uploaded
    f
    • 2
    • 1
  • a

    Andy Gibel

    12/05/2019, 9:59 PM
    I just wish Youtube premium let you download the current buffer for offline viewing 😕
    m
    • 2
    • 2
  • m

    Marc Reichelt

    12/05/2019, 10:04 PM
    There is a pretty cool new webpage by JetBrains, dedicated for doing cross-platform mobile development with Kotlin: https://twitter.com/igrekde/status/1202583848896409600
    m
    • 2
    • 5
  • m

    Maurice Jouvet

    12/06/2019, 9:34 AM
    Hi everyone, the KotlinConf is awesome, I found lot of promising stuff for the multiplaform part. Though, I have a question, there is a codelab: Preparing Your Kotlin Multiplatform Development Environment (Big Nerd Ranch) Since it’s a codelab, there isn’t any video. Does someone attended to this? Is there any web sources?
    e
    • 2
    • 2
Powered by Linen
Title
m

Maurice Jouvet

12/06/2019, 9:34 AM
Hi everyone, the KotlinConf is awesome, I found lot of promising stuff for the multiplaform part. Though, I have a question, there is a codelab: Preparing Your Kotlin Multiplatform Development Environment (Big Nerd Ranch) Since it’s a codelab, there isn’t any video. Does someone attended to this? Is there any web sources?
e

Ellen Shapiro

12/06/2019, 10:49 AM
You should ping Big Nerd Ranch on twitter - I’m not sure if there are, but if there are they’d probably share them there
m

Maurice Jouvet

12/06/2019, 1:16 PM
Thanks, that a good idea!
View count: 12