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

    Kris Wong

    04/25/2019, 9:18 PM
    I notice when using the cocoapod plugin, I need to delete the build directory in my mpp project any time I switch ABIs (device/sim). is that expected?
    p
    i
    • 3
    • 19
  • k

    Kris Wong

    04/25/2019, 10:01 PM
    also, when I archive my app from Xcode, I am getting undefined symbols from my mpp project: Undefined symbols for architecture armv7: "_OBJC_CLASS_$_ConferenceDialerConferenceDialerParser", referenced from: objc-class-ref in ConferenceParserFactory.o objc-class-ref in ConferenceParserV2Adapter.o ld: symbol(s) not found for architecture armv7
    s
    • 2
    • 8
  • d

    d.bellingroth

    04/26/2019, 7:36 AM
    I'm not shure if this is the right channel. But I have a question regarding a multiplatform library project. We are developing a multiplatform library that will be used in a backend service written in Kotlin (JVM) and in a frontend written in JavaScript. But we did not find a good way to embed the generated JS-Code (including dependencies like kotlin-stdlib and kotlinx-serialization) in our javascript build process. Is there any way to generate a npm-package for the javascript part of a multiplatform-project. Or at least a way to generate a compiled JavaScript file that includes the needed dependencies?
    h
    • 2
    • 2
  • k

    kpgalligan

    04/26/2019, 9:08 PM
    I haven’t quite sorted details yet, but we’re going to have a Kotlin MP track on one of the days at Droidcon NYC. CFP just opened: https://sessionize.com/droidcon-nyc-2019/
    💸 1
    🙌 10
    p
    • 2
    • 1
  • a

    andrew

    04/27/2019, 2:11 AM
    Anyone having this issue when building on kotlin version 1.3.30?
    KMP Gradle Build.txt
    d
    d
    s
    • 4
    • 7
  • g

    galex

    04/27/2019, 7:35 AM
    Within the new cocoapods gradle plugin, can I change the name of the module so my iOS project uses MyModuleCommon instead of mymodule_common?
    s
    t
    i
    • 4
    • 9
  • k

    Konstantin Tskhovrebov

    04/27/2019, 12:29 PM
    How can I add source directory with generated proto classes for js target in my multiplatform project? For java it looks like:
    kotlin
    
    apply plugin: "kotlin-multiplatform"
    apply plugin: "java"
    apply plugin: "com.google.protobuf"
    
    kotlin {
        targets {
            fromPreset(presets.jvmWithJava, "jvm")
        }
    //....
    }
    
    java {
        sourceSets {
            main {
                java.srcDirs += "build/generated/source/proto/main/javalite"
                proto.srcDirs += "src/proto"
            }
        }
    }
    d
    • 2
    • 3
  • r

    robstoll

    04/28/2019, 4:19 PM
    I have released version 0.8.0 of Atrium (an assertion library), supporting now JS and Android next to JVM - check it out (and feedback is welcome): https://github.com/robstoll/atrium
    👍 5
    d
    • 2
    • 3
  • s

    Simon Schubert

    04/29/2019, 8:06 AM
    it would be amazing if the https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html#updating-gradle-scripts would have gradle examples for groovy and kotlin. I stuck on how to define the kotlin target for ios in kotlin gradle. Can anyone help me out?
    final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                                  ? presets.iosArm64 : presets.iosX64
    
            fromPreset(iOSTarget, 'ios') {
                 binaries {
                    framework('SharedCode')
                }
            }
    g
    r
    • 3
    • 4
  • m

    max.denissov

    04/29/2019, 11:21 AM
    Who used WebSocket in MPP ? Does ktor support iOS platform?
    t
    g
    d
    • 4
    • 4
  • d

    darkmoon_uk

    04/29/2019, 12:00 PM
    Not sure if I just need to set some framework binary options in Kotlin or whether I'm going to need to poke a suitable
    Info.plist
    in there manually...
    r
    m
    s
    • 4
    • 8
  • j

    Jan Stoltman

    04/29/2019, 1:10 PM
    Hey guys, does anybody here have experience with both InteliJ IDEA and Android Studio for MPP? Which one would you recommend?
    s
    r
    • 3
    • 9
  • m

    mben

    04/29/2019, 1:33 PM
    Hello i'm trying to use runBlocking inside my commonTest module but ide can't find it is it because runBlocking isn't available in kotlinx.coroutines?
    k
    • 2
    • 12
  • d

    Dico

    04/30/2019, 7:14 AM
    I'm asking because some time ago I figured out how to explicitly select one of multiple source sets that have the same target (jvm) - which fixes this issue -
    • 1
    • 7
  • m

    mben

    04/30/2019, 9:31 AM
    Hello im' trying to test jacoco with my mpp commonTest anyone has a sample for how to set up this pleaz?
    g
    • 2
    • 2
  • p

    Patrick Jackson

    04/30/2019, 12:20 PM
    Hi All, a new Kotlin Multiplatform library - FuzzyWuzzy-Kotlin. Useful for fuzzy string matching/string similarity scoring. Builds to JVM, iOS, js, macOS, linux, wasm, win (only iOS, JVM, JS are tested). https://github.com/willowtreeapps/fuzzywuzzy-kotlin
    👍 4
    l
    r
    • 3
    • 6
  • r

    r4zzz4k

    04/30/2019, 9:11 PM
    Do I understand correctly that
    kotlin-multiplatform
    doesn't support
    module-info.java
    yet? So one is unable to use, for example, OpenJFX within multiplatform project?
    e
    • 2
    • 2
  • d

    darkmoon_uk

    05/01/2019, 2:58 AM
    Usual story: I've a multi-platform library which is consumed by both Client and Server parts of my App. I notice when the Server (a JVM-only project) builds, I see in the log
    WARNING: Ignoring dependency of module 'my-common' on module 'my-server'. Java modules cannot depend on Android modules
    . Firstly this log message seems the worded the wrong way around (it's 'my-server' depending on 'my-common'), but I'm assuming it appears because the
    common
    module uses the Android plugin for the benefit of its Android source set. This seems like a potential problem to me - is there no way to constrain the application of the Android (or other plugins) to only the build of a specific source-set? Otherwise I see this scheme spelling trouble for inter-module dependencies where multi-platform libraries are concerned.
    a
    k
    • 3
    • 42
  • d

    darkmoon_uk

    05/01/2019, 9:25 AM
    Silly question; what are the
    -kotlinMultiplatform
    POMs for, that I'm seeing in repo's, e.g. https://kotlin.bintray.com/ktor/io/ktor/ktor-client-websocket-kotlinMultiplatform/1.1.5/ ?
    i
    c
    • 3
    • 2
  • b

    basher

    05/01/2019, 2:40 PM
    Does anyone have an example of using FatFrameworkTask from groovy build gradle? https://github.com/JetBrains/kotlin/blob/64fbbc3a702511fdd1a5ffdaa4b9a1804711195d/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/FatFrameworkTask.kt
    t
    • 2
    • 5
  • i

    Imran/Malic

    05/02/2019, 7:55 AM
    Does anyone have a small example besides SQLdelight on how to generate Kotlin files with PSI ?
    d
    r
    +2
    • 5
    • 16
  • d

    darkmoon_uk

    05/02/2019, 8:58 AM
    Just stumbled across @Deactivated User’s Multiplatform Libraries page on the web. Check it out if you haven't seen it yet... https://korlibs.soywiz.com/ ...fantastic work, @Deactivated User 👏 😄
    :tnx: 1
    :kotlin: 4
    👍 7
    d
    • 2
    • 1
  • l

    LeoColman

    05/02/2019, 4:08 PM
    Hey guys, Kotlin MPP doesn't work very well with reflection right now, right?
    :yes: 2
    s
    e
    t
    • 4
    • 14
  • s

    serebit

    05/02/2019, 9:05 PM
    On the latest kotlin/native (1.3.31 multiplatform plugin), nearly all of the test files I have in my common source set are failing in the task
    linkTestDebugExecutableLinuxX64
    . I’ll post a stack trace once I get back to my computer.
    t
    j
    +2
    • 5
    • 6
  • d

    darkmoon_uk

    05/03/2019, 8:33 AM
    Once you have a target fully defined i.e. in Gradle, what's the easiest 'one liner' or one-line comment to disable the target, for faster building?
    r
    s
    • 3
    • 3
  • j

    Jens Baitinger

    05/03/2019, 9:12 AM
    hi, I wanted to exclude a transitive dependency in one of the platforms dependencies im my gradle configuration, but I get the error message
    Could not find method api() for arguments [project ':...', build_ckdfo2mkuty2268dk8wzojs1m$_run_closure1$_closure2$_closure4$_closure5@5af0b522] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler.
    any clues?
    kotlin {
        sourceSets {
            commonTest.dependencies {
                api (project("…")) {
                    exclude group: "…", module: "…"
                }
            }
        }
    }
    m
    • 2
    • 6
  • r

    Rainer Schlonvoigt

    05/03/2019, 11:29 AM
    is there an easy way to have a default implementation for expect/actuals ?
    l
    • 2
    • 2
  • m

    Marc Knaup

    05/03/2019, 12:32 PM
    Is it just me where the project view doesn't update properly in multiplatform projects? I add a file, it's not there (but in the file system). I move a file - it's not shown (but moved in the file system). Changes in the file system are also not reflected in the project view. "Synchronize" command doesn't change anything. It only synchronized randomly or at least upon IDE restart.
    k
    • 2
    • 7
  • r

    ribesg

    05/03/2019, 1:01 PM
    Anyone got an example of Android & iOS testing in a multiplatform library and app(s)?
    d
    k
    +2
    • 5
    • 21
  • d

    darkmoon_uk

    05/03/2019, 1:41 PM
    I've come to a realisation about MPP and interested in others thoughts - regarding the two current 'Gradle models' of achieving MPP - let's call them (1) platform-per-module and (2) platform-per-sourceSet. Thread continues inside...
    k
    j
    +2
    • 5
    • 25
Powered by Linen
Title
d

darkmoon_uk

05/03/2019, 1:41 PM
I've come to a realisation about MPP and interested in others thoughts - regarding the two current 'Gradle models' of achieving MPP - let's call them (1) platform-per-module and (2) platform-per-sourceSet. Thread continues inside...
Broadly; it seems that for the libraries/modules of an App, yes: (2) platform-per-sourceSet offers more concise organisation, less Gradle boilerplate to get the same job done. For top-level Application Gradle modules though, it appears that (1) platform-per-module is the more comfortable - avoiding crowding and incompatibility between, say, Android and JavaFX plugins in the same module... alongside iOS setup - all in the same file! No; that is better split to a Gradle module per platform. Can anyone concur with or challenge this position? Because (2) platform-per-sourceSet came second, and appears to serve a similar purpose as (1), it's been referred to as the 'new way' of doing things by some, with the implication that one should migrate away from platform-per-module. But as I get further into the project I am setting up; I can see clear use for both ways. Don't both have their place?
k

kpgalligan

05/03/2019, 1:53 PM
I don’t know what JB’s plans are, but it’s the “new way” to some, but the “platform-per-module” was also the “new way” depending on when you started (see “konan” plugin). I am a little torn here. I didn’t hate the PPM layout, but adjusted to the PPSS. From a library perspective, the PPSS allows for more consolidated dependency definition, which AFAIK isn’t implemented in PPM.
I got the impression PPM would eventually be deprecated, so that compelled the move towards PPSS. Even if not “deprecated”, it seems unlikely that all new features and capabilities will be deployed to both.
d

darkmoon_uk

05/03/2019, 1:55 PM
I guess what I'm saying is, it doesn't have to be one or the other - they both have their place. PPSS is nice, but I've found that in all but the most trivial setups, problems arise from having so many supporting plugins for different platforms in the same Gradle configuration space.
Neither does it feel desirable - trawling through the supporting configuration for essentially 3 different Apps in one file.
(In this case; Android, iOS and JavaFX Desktop... possibly Web later too)
k

kpgalligan

05/03/2019, 1:56 PM
From reading your specific case, that the java and android plugins can’t live in the same module, I’d create interfaces rather than expect/actual classes, which is largely what we’re doing now for testability, and create one “base” module, then platform specific ones that do a project dependency.
👍 1
The only explicitly incompatible ones are android and java, which I’ve hit in other contexts. It’s crap. That android plugin is complex, and finicky. Not necessarily saying I agree or disagree with your position. Just thinking it unlikely that both plugins will get the same attention at JB, so we focus on the PPSS.
Not to knock the android plugin. They get constantly criticized for being “slow” so they super optimize it (they being Google).
Our “sample project” has been morphing over time. We have an android lib in the shared module, but I’ve been considering just making that a java dep. The testing situation now means we probably don’t need it to be an android lib https://github.com/touchlab/DroidconKotlin/
j

jw

05/03/2019, 2:03 PM
When you have a bunch of libraries, the old way was terrible. Maintaining 3 parallel sets of dependencies for every module. Having 4 modules instead of 1 for each library. It was awful.
➕ 1
👆 1
d

darkmoon_uk

05/03/2019, 2:03 PM
Thanks for the input Kevin, that makes sense; I'm keen to find out what JB's intentions are for the
kotlin-platform-*
plugins - it's hard to find a clear answer on whether they're deprecated or not. My suspicion is that there are so many ideas in the wash with Kotlin at the moment, that they don't have a clear answer themselves and are seeing what remains useful over time.
k

kpgalligan

05/03/2019, 2:05 PM
Yeah, I suspect that is how the decision will be made on the 2 plugins. See how it goes.
d

darkmoon_uk

05/03/2019, 2:06 PM
I can definitely see that for Libraries @jw. Conversely, it also feels pretty bad having all the config for several top level Apps in the same gradle file without any explicit scoping - so I'm hoping both ways continue to be supported.
j

jw

05/03/2019, 2:07 PM
Yeah I still put the apps in their own modules. The plugin is smart enough to figure out that an android module, a java module, or a js module depending on a MPP one should choose the correct artifact
✔️ 1
I don't have any expect/actual at that layer
👍 1
k

kpgalligan

05/03/2019, 2:22 PM
Our internal multiplatform learning arc has been learning how to put expect/actual everywhere, then learning how to take it out.
😅 1
i

ian.shaun.thomas

05/03/2019, 3:08 PM
^ that feeling when you realize you really only needed interfaces the entire time
a

alec

05/03/2019, 11:38 PM
ive found expect/actual useful for library development but not for application development
👍 1
d

darkmoon_uk

05/05/2019, 10:58 PM
Having been back and forth on this a couple of times now in my project setup (now willing to accept a compromise and move on...), concluded a couple more things: 1. It does look like JB are firmly guiding us towards Platform per Source Set as supporting plugins for iOS like
xcode-compat
are for
multiplatform
, and there is no
kotlin-platform-ios
or
kotlin-platform-native
etc. making iOS setup, in particular, more difficult and unsupported without
multiplatform
.
2. The clash between
java
and
android
plugins remains a horrible limiting factor of the Platform per Source Set model - meaning it's currently impossible to use expect/actual between Android and Java targets defined in the same module.
i

ian.shaun.thomas

05/05/2019, 11:00 PM
I have started keeping android solo from everything else. It's the only one that can't play nice with others so far in my experience.
d

darkmoon_uk

05/05/2019, 11:03 PM
I've arrived at keeping all the top-level App definitions separate too now; the compromise I mentioned, is that I was hoping to at least have a common library where each platform could have
expect/actual
definitions. That's now limited to just having a
jvm
target covering both Desktop and Android.
...back to what @kpgalligan and @ian.shaun.thomas both said then, the solution to abstracting has to be interfaces, and not expect/actual 🙄
i

ian.shaun.thomas

05/05/2019, 11:29 PM
Well expect actual is fine you should just prefer interfaces as it simplifies your life.
View count: 5