https://kotlinlang.org logo
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
  • d

    Daniele B

    08/16/2020, 2:46 PM
    do you know if these libraries are supervised directly by the Firebase team? https://firebaseopensource.com/projects/gitliveapp/firebase-kotlin-sdk do you have experience working with these libraries? are they the best you can find for Firebase in Kotlin Multiplatform?
    a
    j
    g
    • 4
    • 4
  • s

    saket

    08/16/2020, 9:07 PM
    Huh, changing my IDE plugin to 1.4.0-rc fixes the problem.
    r
    • 2
    • 2
  • t

    Thomas Skovsgaard

    08/17/2020, 5:52 AM
    Hi, I'm trying to use swiftUI and KMP together, my viewmodels are shared between android and iOS, but I can't seem to figure out how to respond to changes in swiftUI, when my viewmodel is using StateFlow. Has anyone had any luck with that ?
    👀 1
    k
    • 2
    • 2
  • g

    gregorbg

    08/17/2020, 9:36 PM
    Hey! Are there any good resources on how to split different multiplatform targets into different Gradle modules/projects? I have an existing Gradle build with
    projectRoot/frontend
    (JS) and
    projectRoot/backend
    (JVM) as individual modules and I'd like to migrate to Kotlin without changing the project structure too much
    a
    • 2
    • 5
  • r

    Ricky

    08/18/2020, 3:17 AM
    Would it be possible to use KMP as multi-project style? like
    common/
    - src/
    - build.gradle.kts
    jvm/
    - src/
    - build.gradle.kts
    js/
    - src/
    - build.gradle.kts
    vs
    src/
    - commonMain
    - jvmMain
    - jsMain
    build.gradle.kts
    I need to use two plugins (that conflict with each other), if I have it as multi-project I can apply each plugin for the associated target
    w
    • 2
    • 1
  • r

    Ricky

    08/18/2020, 3:19 AM
    Also, would it be possible to have a jvm common? since the entire project would be in jvm only.
    t
    • 2
    • 3
  • b

    bod

    08/18/2020, 11:41 AM
    Hello, World! So I'm trying to re-open a MP project that I've not opened for a few months... And I get:
    There are 33 third-party libraries attached to the project that were compiled with an older Kotlin/Native compiler and cant be read in IDE
    and almost everything is red in the IDE. I've tried to update all my dependencies to their latest versions, but this didn't improve the situation. Is that normal?
    j
    l
    • 3
    • 16
  • k

    Kathrin Petrova

    08/18/2020, 2:18 PM
    Hey everyone! My name is Kate, and I’m the new developer advocate for Kotlin Multiplatform Mobile. I’d be happy to help you dig into KMM and chat about your experience with KMM anytime. As you know, we’ve just released Kotlin 1.4! 🥳To help you start using the new features of Kotlin multiplatform in existing projects, we've published the migration guide for multiplatform projects. We’ll be very grateful if you report any bugs you find to our issue tracker.
    👋 14
    ❤️ 1
    🎉 21
    k
    a
    l
    • 4
    • 4
  • k

    kai widmer

    08/18/2020, 2:35 PM
    hi everyone, currently I'm receiving an error while building android/ios multiplatform-project:
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':shared:compileKotlinIos'.
    > java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.utilities.MainKt
    gradlew --version:
    ------------------------------------------------------------
    Gradle 6.5.1
    ------------------------------------------------------------
    
    Build time:  2020-06-30 06:32:47 UTC
    Revision:   66bc713f7169626a7f0134bf452abde51550ea0a
    
    Kotlin:    1.3.72
    Groovy:    2.5.11
    Ant:     Apache Ant(TM) version 1.10.7 compiled on September 1 2019
    JVM:     1.8.0_242-release (JetBrains s.r.o 25.242-b3-6222593)
    OS:      Mac OS X 10.15.6 x86_64
    Did anybody have a similar problem?
    s
    • 2
    • 1
  • j

    John O'Reilly

    08/18/2020, 3:45 PM
    Kotlinx Coroutines
    1.3.9-native-mt
    version now available https://github.com/Kotlin/kotlinx.coroutines/issues/462#issuecomment-675553478
    a
    • 2
    • 2
  • r

    Ricky

    08/18/2020, 7:51 PM
    Is there a way to use KMP like this? having expect/actual would be really useful for this project.
    🇳🇴 2
    r
    • 2
    • 3
  • e

    edenman

    08/19/2020, 2:23 AM
    I have a
    KClass<T>
    and I would like to get a corresponding `KType`….
    KClass.createType
    is JVM-only, anybody know if there’s a KMP way to do this?
    m
    • 2
    • 3
  • s

    Sergei Novikov

    08/19/2020, 6:57 AM
    Hi everyone, can you please tell me if it is possible to use Retrofit in a MP library?
    g
    h
    • 3
    • 5
  • n

    nrobi

    08/19/2020, 10:16 AM
    Shouldn’t
    withContext(Dispatchers.Default)
    work with coroutines
    1.3.8-native-mt-1.4.0-rc
    on iOS as well? I’m getting
    There is no event loop. Use runBlocking { ... } to start one.
    j
    • 2
    • 2
  • t

    tylerwilson

    08/19/2020, 2:44 PM
    How is there no common String.format yet? 😞
    d
    c
    • 3
    • 5
  • n

    Nick

    08/19/2020, 3:39 PM
    Has anyone been able to get a j2objc library to work on multiplatform? I’m importing the library using cocoapods.
    xcodebuild
    fails to build the Pods.xcodeproj with error 65.
    ** BUILD FAILED **
    The following build commands failed
    CompileC [long dir]/AbstractQuoteEventSchema.o [long dir]/AbstractQuoteEventSchema.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC [long dir]/AccountBalanceMessageHandler.o [long dir/AccountBalanceMessageHandler.m  normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    k
    • 2
    • 7
  • e

    Evan

    08/19/2020, 9:43 PM
    does anyone know how the kotlin targets
    androidTest
    and
    androidAndroidTest
    interact? I can’t run instrumentation tests unless I comment out `androidTest`’s dependencies due to a duplicate class exception. Also, my
    androidTest
    unit tests don’t pass if I have dependencies in
    androidAndroidTest
    , but they pass once I comment the instrumentation dependencies out.
    👀 1
    v
    • 2
    • 3
  • h

    hultgren

    08/20/2020, 1:36 AM
    When migrating my MP project to kotlin 1.4 I ran into a problem with publishing android artifacts. This:
    android {
            publishLibraryVariants("release", "debug")
        }
    used to work fine but after migrating I get this error:
    Kotlin target 'android' tried to set up publishing for Android build variants that are not library variants or do not exist:
    * release
    * debug
    Check the 'publishLibraryVariants' property, it should point to existing Android library variants. Publishing of application and test variants is not supported.
    Replacing above with
    publishAllLibraryVariants()
    does build, but it publishes no android artifacts. Anyone else seen this?
    a
    m
    • 3
    • 3
  • o

    Oleh

    08/20/2020, 8:52 AM
    Hey guys, anyone has migrated successfully MPP project that uses ktor to 1.4? I’m receiving
    Could not resolve io.ktor:ktor-client-json-native:1.4.0.
    all the time. When I setup only
    core
    dependency, android/ios client doesn’t appear there.
    j
    • 2
    • 3
  • r

    ribesg

    08/20/2020, 11:51 AM
    Quick question, when documenting
    expect
    -
    actual
    things, do you need to copy the KDoc on each
    actual
    on each platform or is documenting
    expect
    enough? I’m talking mostly from a IDEA-picking-it-up point of view
    a
    l
    +2
    • 5
    • 9
  • k

    Kris Wong

    08/20/2020, 2:33 PM
    does anyone know whether 1.4 supports macOS Arm64?
    d
    • 2
    • 1
  • e

    Erik Christensen

    08/21/2020, 3:36 AM
    Is anyone aware of (or working on) a compiler plugin that can automatically rename test methods with nice back tick names to valid names on the platforms that don't support them, like JS? Basically, applying
    JsName()
    without having to do it by hand.
    j
    • 2
    • 2
  • t

    Tristan

    08/21/2020, 1:44 PM
    Hello, I just started a new project through the wizard and I am getting a lot of highlights in my gradle file. Do you have an idea of how I could fix it?
    s
    • 2
    • 6
  • m

    Marcin Bak

    08/21/2020, 2:44 PM
    Hi, I have two gradle modules in my project: •
    shared-library
    (kmp targeting jvm, js and ios) with just 1 class in commonMain •
    jvmApp
    (simple jvm module) with dependency to shared-library
    implementation(project(path = ":shared-library"))
    For some reason
    jvmApp
    module doesn’t see the class defined in shared-library Any ideas what I could be doing wrong?
    • 1
    • 1
  • w

    Wolf Logan

    08/21/2020, 5:51 PM
    I'm running into an internal compiler error while trying to migrate my project to Kotlin 1.4. I have a Kotlin Multiplatform project (Gradle w/Kotlin dialect) building for two targets (JS and JVM); the JVM target uses Spring Boot 2.2.6. With the project configured to use the 1.3.72 plugin, everything builds fine. Moving to the 1.4.0 plugin (and updating Kotlin library references to 1.4.0) causes the build to fail with the error below:
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':compileKotlinJvm'.
    > Internal compiler error. See log for more details
     . . .
    /xxx/xxx/xxx.kt:57
      @PutMapping("/{userId}", consumes = [MediaType.APPLICATION_JSON_VALUE])
                                          ^
    e: org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (57,39) in /xxx/xxx/xxx.kt
    	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.logOrThrowException(ExpressionTypingVisitorDispatcher.java:253)
     . . .
    Caused by: java.lang.NoSuchMethodError: kotlin.sequences.SequencesKt.flatMapIterable(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
    	at org.jetbrains.kotlin.resolve.calls.components.CollectionTypeVariableUsagesInfo.getDependentTypeParameters(ResolutionParts.kt:364)
    r
    • 2
    • 5
  • c

    Carter

    08/21/2020, 8:26 PM
    I’m running into trouble with Kotlin 1.4, multiplatform, and serialization. I’m getting the warning “The Kotlin Gradle plugin was loaded multiple times in different subprojects”. It seems to be due to the fact that I have a library module that declares using the serialization plugin, and then that library module is consumed by an application module. Is there something incorrect in my setup? Library module declares:
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization")
    }
    App module, which depends on library module, declares:
    plugins {
        kotlin("multiplatform")
        id("application")
    }
    My settings.gradle.kts declares:
    pluginManagement {
        plugins {
            kotlin("multiplatform") version("1.4.0")
            kotlin("plugin.serialization") version("1.4.0")
        }
    }
    j
    • 2
    • 9
  • t

    takahirom

    08/22/2020, 8:18 AM
    This is just interesting, can I use Kotlin multiplatform implementation from go lang or rust? Do you have a plan for it?
    a
    • 2
    • 2
  • o

    oshai

    08/23/2020, 12:16 PM
    Hi, does anybody know of an issue with KMP 1.4 support for
    artifactId
    ? It looks like it ignores that directive in the jar name
    l
    • 2
    • 18
  • m

    Marc Knaup

    08/23/2020, 3:53 PM
    Is there an idiomatic way to memoize values that works multiplatform (and esp. across threads in Native)? E.g.
    private val hash: Int by lazy { … }
    but
    lazy
    doesn’t work across threads in Native afaik.
    a
    s
    • 3
    • 5
  • m

    Marc Knaup

    08/23/2020, 7:59 PM
    This is weird. I have two libraries: (A) multiplatform library with JVM target +
    withJava()
    (B) multiplatform library with JVM target that depends on (A) - (no
    withJava()
    ) If I add my java sources folder to the Kotlin JVM target of (A), then (A) compiles successfully but (B) can’t see the Java symbols. If I add my java sources folder to the entire project (just like in a normal Java project) of (A) then (A) doesn’t see the symbols but (B) does. If I specify the source set configuration for both in (A), i.e. in the Kotlin JVM target AND in the Java project, then it works fine in both 🤔 What’s the right way to set that up?
    d
    • 2
    • 2
Powered by Linen
Title
m

Marc Knaup

08/23/2020, 7:59 PM
This is weird. I have two libraries: (A) multiplatform library with JVM target +
withJava()
(B) multiplatform library with JVM target that depends on (A) - (no
withJava()
) If I add my java sources folder to the Kotlin JVM target of (A), then (A) compiles successfully but (B) can’t see the Java symbols. If I add my java sources folder to the entire project (just like in a normal Java project) of (A) then (A) doesn’t see the symbols but (B) does. If I specify the source set configuration for both in (A), i.e. in the Kotlin JVM target AND in the Java project, then it works fine in both 🤔 What’s the right way to set that up?
d

Dominaezzz

08/23/2020, 8:31 PM
Are you using the
java
folder or the
kotlin
folder?
m

Marc Knaup

08/23/2020, 8:32 PM
Neither, I have to add my own source directories.
View count: 6