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

    alex.hart

    12/13/2017, 1:44 PM
    Yes this is totally possible. Just keep in mind that right now a lot of kotlin libraries don’t support the common platform, and explicitly target either the JVM or JS. If there are specific tools you’re looking to use (such as Rx) you’ll need to either keep your common logic completely synchronous and Rx free (and implement async in platform-jvm and platform-js) or do some wrapping.
    g
    r
    • 3
    • 2
  • r

    roughike

    12/13/2017, 1:46 PM
    Thanks for the response! So, for example, https://github.com/rozag/kozy-redux is written entirely in Kotlin, but it should also explicitly support the common platform somehow?
    s
    a
    • 3
    • 3
  • a

    alex.hart

    12/13/2017, 2:21 PM
    That’s perfectly fine. At the end of the day I believe you should be able to compile your common stuff into what’s more or less a node module (someone correct me if I’m wrong)
    n
    • 2
    • 2
  • a

    arocnies

    12/13/2017, 11:37 PM
    On the note of libraries targeting multiplateforms: Dartlang shares this problem with Dart/Web, Dart/Server, and Dart/Flutter. Dart helps ease the pain of using and finding the right libraries with this site: https://pub.dartlang.org/ It would be great to have something similar for Kotlin where authors could tag their libraries for multiple platforms and provide documentation and links.
    n
    • 2
    • 8
  • s

    steamstreet

    12/14/2017, 3:22 AM
    Having problems with all the latest stuff. I have a
    common
    module, a
    common-js
    and a
    common-jvm
    , and then another JVM module that depends on
    common-jvm
    . All compiles fine with Gradle, but the latest IntelliJ fails to compile, saying that it can’t find definitions, even though the source code is not marked red.
    i
    • 2
    • 2
  • x

    xdetant

    12/14/2017, 5:04 PM
    to add parameterized tests
    g
    • 2
    • 4
  • e

    egorand

    12/18/2017, 5:18 PM
    the IDE complains about accessing
    internal
    members of the common module from a platform module, but this seems to work - is this a known issue?
    i
    • 2
    • 1
  • k

    karelpeeters

    12/18/2017, 7:40 PM
    Out of interest, why was it deprecated?
    i
    v
    • 3
    • 3
  • o

    oshai

    12/27/2017, 8:04 PM
    I would like to make
    kotlin-logging
    multi platform (supports also js). After watching yole video about it I still have one open question about the concept: I will create such support the lib will have 2 artifacts one for jvm and one for js. How should Application developer with multiplatfom code depend on kotlin-logging? the jvm module will depend the jvm artifact, the js module will depend js artifact, but what should the common code depend on? third artifact for common? should it be an artifact only for compilation (because js will have same classes also for example)?
  • l

    lewik

    12/28/2017, 7:21 AM
    @marcinmoskala Please read answer above. Looks like you need make "backend" depend on "common-jvm" and "common-jvm" depend on "common" (I think it's better merge kotlin-jvm and backend... may be)
    m
    • 2
    • 5
  • l

    lewik

    12/28/2017, 11:07 AM
    added jitpack to https://github.com/Lewik/klogging so you are able to add it as dependency
    l
    • 2
    • 2
  • v

    vmichalak

    01/04/2018, 9:57 AM
    Hi Kotlin Team, Do you plan to purpose a Number Generator (Math.Random in js / java.util.Random in java) in the Kotlin Standard Lib ? In my multiplatform project we had to implement a Linear Congruential Generator directly in pure kotlin to do the job but even if it's relatively easy to implement it's not the best option we think.
    l
    n
    k
    • 4
    • 15
  • v

    vmichalak

    01/04/2018, 9:57 AM
    (sorry for the misthread posting @louiscad)
    l
    • 2
    • 1
  • j

    jw

    01/04/2018, 2:47 PM
    threads are the worst thing to happen to slack. the entirety of useful conversation abstracted behind information silos requiring that i click into each one. they needn't be used in such small channels.
    :thread-please: 2
    l
    • 2
    • 10
  • s

    Sam

    01/10/2018, 12:08 AM
    I'm trying to do this setup Android App -> Android AAR -> common-jvm -> common and am having mixed success. The app can see classes in the AAR. The AAR can see classes in the common-jvm jar. The problem is that I want to have the App access classes in the common-jvm.jar but I'm not having any luck. The code can be found at https://github.com/samus/pistachio
    r
    • 2
    • 2
  • j

    jw

    01/12/2018, 8:49 PM
    do you have common tests?
    a
    i
    • 3
    • 8
  • v

    vsazel

    01/17/2018, 7:47 AM
    I have something like that. https://github.com/wojta/hello-kotlin
    • 1
    • 1
  • s

    steamstreet

    01/23/2018, 6:05 AM
    Can I not include regular implementation code in a common module? When I create a regular class in the common module, it doesn’t seem to be visible when I depend on the JVM or JS implementation modules.
    m
    • 2
    • 1
  • m

    marcinmoskala

    01/23/2018, 12:28 PM
    I see that
    @JvmName
    can be used on common modules, but
    @JsName
    not. Any way to set name for JS in multiplatform projects? (Problem is that JS doesn't accept names like
    fun `this is name`(){}
    )
    a
    • 2
    • 5
  • m

    marcinmoskala

    01/29/2018, 3:50 AM
    I've published an article about testing common modules. I will promote it today. It would be nice to have some feedback 🙂 https://blog.kotlin-academy.com/testing-common-modules-66b39d641617
    👍 1
    ➕ 2
    🎉 4
    a
    • 2
    • 1
  • g

    gaetan

    01/29/2018, 10:03 AM
    @marcinmoskala Really nice post. Good catch on asynchronous testing. I did know the workaround. 👍
    m
    • 2
    • 1
  • t

    timm

    01/30/2018, 12:08 PM
    Hey guys. When i am using the annotion `@JvmName`in my common code, the compiler fails to compile the JS Module using the common code. (JvmName is internal to kotlin.jvm). Is there a fix for it?
    a
    u
    • 3
    • 12
  • l

    lewik

    02/03/2018, 2:53 PM
    How to use Spring @LastModifiedDate with entities in kotlin common (mongo)? Any ideas?
    s
    • 2
    • 5
  • c

    colintheshots

    02/04/2018, 2:27 PM
    I have a Kotlin multiplatform project, but I noticed a lot of methods recently became unresolved in IntelliJ. It looks like upgrading to the latest Kotlin version, the web module can no longer find the gradle task copyDependenciesKotlinJs. How would I fix this?
    d
    • 2
    • 1
  • r

    rellenberger

    02/06/2018, 5:56 PM
    Which IDE are most people using for mutliplatform projects? Will I have to use IDEA and CLion if I want to do Android, iOS, and web?
    g
    a
    • 3
    • 6
  • c

    czyzby

    02/10/2018, 9:28 PM
    Would anyone mind taking a look at my multiplatform JVM/JS project attempt? I wonder if I got the configuration right. https://github.com/czyzby/kotlin-multiplatform-example
    a
    • 2
    • 28
  • s

    Simone Civetta

    02/17/2018, 12:56 PM
    Hi, I’m trying to get a multiplatform (iOS and Android) project running. Unfortunately as of today it looks like
    kotlin-platform-android
    has not made primetime yet. Also, if I apply both
    kotlin-platform-jvm
    and
    kotlin-android
    I’m getting a
    Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
    ... Am I missing something here?
    :rubber_duck: 1
    • 1
    • 1
  • b

    benleggiero

    02/19/2018, 4:31 AM
    Why did someone respond with :rubber_duck:…?
    😁 1
    g
    • 2
    • 3
  • r

    Rob

    02/19/2018, 1:37 PM
    I'm building a multiplatform project for js/jvm/ios that expects a sealed class. It seems to build fine for JS and JVM but for iOS i'm getting "exception: java.lang.AssertionError: expect class WriteLog: Super class should be any: actual class Operation". Are sealed classes or class hierarchies going to be supported for native compilation?
    r
    • 2
    • 2
  • d

    david.bilik

    02/20/2018, 12:40 PM
    Hi, I want to try the thing that most of the Android devs wants to try now - do the multiplatform project that has shared code for android/ios written in kotlin .. Whats the best way to start? I cannot find any “tutorial 101” about what IDE to use to develop common part and platform specific parts - can I do it all in IntelliJ? Or for iOS I need CLion? Practically I am looking for some resources that summarize that 🙂
    👍 2
    r
    s
    a
    • 4
    • 8
Powered by Linen
Title
d

david.bilik

02/20/2018, 12:40 PM
Hi, I want to try the thing that most of the Android devs wants to try now - do the multiplatform project that has shared code for android/ios written in kotlin .. Whats the best way to start? I cannot find any “tutorial 101” about what IDE to use to develop common part and platform specific parts - can I do it all in IntelliJ? Or for iOS I need CLion? Practically I am looking for some resources that summarize that 🙂
👍 2
r

Rob

02/20/2018, 1:36 PM
https://www.novoda.com/blog/kotlin-goes-ios/
d

david.bilik

02/20/2018, 2:19 PM
thanks, will look into that 🙂
s

Simone Civetta

02/20/2018, 2:24 PM
https://github.com/viteinfinite/KotlinSlideParser/tree/feature/multiplatform
👍 1
d

david.bilik

02/20/2018, 2:26 PM
@Simone Civetta I’ve looked at that, but that doesnot answer my question abou IDEs 🙂
but otherwise its really good example
s

Simone Civetta

02/20/2018, 2:34 PM
Sure. I’m actually using Android Studio for the common part but IntelliJ works. For iOS, I’m still using Sublime but the new CLion (https://www.jetbrains.com/clion/nextversion/) should be working as well - haven’t tested yet though
d

david.bilik

02/20/2018, 2:39 PM
Isnt it a little masochist to program in text editor? 😄 I cant imagine working without proper refactoring/formatting/autocompletion
a

albertgao

02/21/2018, 9:30 PM
https://github.com/Albert-Gao/kotlin-native-mobile-multiplatform-example I have a setup where you can use Android Studio or XCode to edit the native app while using IDEA to edit the Kotlin part.
View count: 1