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

    gaetan

    02/20/2018, 11:41 PM
    @bashor you asked me to keep you informed about my serialization/parsing of GeoJson. This is how I managed it at the end: https://github.com/data2viz/geojson-kotlin/blob/master/geojson-js/src/main/kotlin/io/data2viz/geojson/js/GeoJsonJs.kt I have two completely different implementations in JS and JVM. I only share some common data class as the result of the parsing.
    b
    • 2
    • 1
  • d

    david.bilik

    02/22/2018, 2:37 PM
    hmm, ok, so what are the best practices for that? Callback hell?
    a
    j
    • 3
    • 4
  • n

    neworldlt

    02/22/2018, 3:19 PM
    I am wondering, is any plans to support junit5 tests on JVM and JS modules?
    b
    • 2
    • 3
  • d

    david.bilik

    02/23/2018, 9:16 AM
    interesting problem - I have
    common
    ,
    common-android
    and
    app
    modules .. in
    common-android
    i have
    expectedBy project(":common")
    . And If I have in
    app
    module
    implementation project (':common')
    IDE can see the classes from
    common
    module, but when i ran the app, it fails that there are Unresolved references to those class .. however if i switch to
    implementation project (':common-android')
    in the
    app
    module, IDE cant see the classes, but build works..am i missing something?
    f
    • 2
    • 1
  • n

    neworldlt

    02/25/2018, 2:08 PM
    I noticed, that new project generation always mess up. Instead, I am creating all configurations by myself for awhile. My configuration:
    (root) - setup only buildscript classpath
         - engine-common -> kotlin-platform-common
         - engine-js -> kotlin-platform-js
         - engine-jvm -> kotlin-platform-jvm
         - backend -> kotlin-jvm
                    - engine-jvm
         - frontend -> kotlin-js
                    - engine-js
    a
    a
    v
    • 4
    • 6
  • g

    gildor

    02/26/2018, 1:20 AM
    @albertgao For now you can use only plugin
    kotlin-platform-jvm
    project to implement JVM APIs and then use it as dependency of your Android project Check this issue: https://youtrack.jetbrains.com/issue/KT-18462 kotlin-platform-android will be available on 1.2.30
    a
    s
    • 3
    • 2
  • s

    spierce7

    02/26/2018, 4:24 AM
    So I'm imagining the testing lifecycle of a Kotlin common module, and it dawned on me that I can't use any jvm specific solutions that I've been relying on to make Kotlin JVM testing manageable. Mockito has something that makes all Kotlin classes / methods non-final and allows easy mocking of kotlin classes (through some additional libraries). I'm assuming there is nothing like that with Kotlin common modules? I'd just have to use interfaces and dependency injection to properly test things?
    a
    • 2
    • 1
  • a

    albertgao

    02/28/2018, 9:48 AM
    ok, now things get complicated. Previously, I made an example of code sharing between iOS and Android via Kotlin native. I even made example of code sharing among jvm, js and kotlin native. They all works. Now the requirement is changed to I need to further separate the platform API into a separate repo. So, now the overall structure becomes something like this: project-platforms: -
    common
    module: Only contain
    expect class
    and no implementation just like plain
    interface
    . Build with plugin
    kotlin-platform-common
    - `😛latforms:jvm`: actual implementation on jvm. It generates library, and I tried in Android Studio, it works. Build with plugin
    kotlin-platform-jvm
    project-lib: - `common`: It contains code which mean to be the same across all platforms. But it depends on the API from
    common
    of
    project-platforms
    . Which means it just depends on the
    common
    code rather than the actual implementation of a certain platform. Build with plugin
    kotlin-platform-common
    - `forBuild:JVM`: Its purpose is for testing
    common
    and build for jvm. So it just embed the source code from
    common
    , and add the generated jar file from
    project-platforms :platforms:jvm
    as dependencies and do the test and build. The testing part works, it will compile and run the test from
    common
    . And build without error. Now the problem is when use the generated jar file from
    forBuild:JVM
    in Android studio. It said:
    java.lang.NoClassDefFoundError: Failed resolution of: Lnz/salect/kotlinidiom/Platform; Caused by: java.lang.ClassNotFoundException: Didn't find class "nz.salect.kotlinidiom.Platform" on path: DexPathList[[zip file "/data/app/nz.salect.handset-1/base.apk", zip file "/data/app/nz.salect.handset-1/split_lib_dependencies_apk.apk"],nativeLibraryDirectories=[/data/app/nz.salect.handset-1/lib/x86, /system/lib, /vendor/lib]]
    And the
    Platform
    class is from
    project-platforms
    which already add its jar file as dependencies. I tried built with either
    kotlin-platform-jvm
    or
    org.jetbrains.kotlin.jvm
    , both yield the same error. What am I missing here?
    a
    i
    • 3
    • 10
  • j

    jw

    03/02/2018, 9:33 PM
    yes, no, respectively
    r
    • 2
    • 5
  • q

    qlitzler

    03/03/2018, 1:48 PM
    Ok solved my issue .. you actually need to
    imlement project
    common-jvm
    and
    common-client-jvm
    in the android module, to reference classes from
    common
    .. seems obvious now
    i
    • 2
    • 2
  • b

    benleggiero

    03/04/2018, 1:36 AM
    Does anyone know a workaround? I’m on the latest 1.2.30
    i
    • 2
    • 6
  • a

    albertgao

    03/05/2018, 5:37 AM
    The latest update to
    kotlin-platform-android
    works well for
    multiplatform project
    , and can generate the aar and jar file without errors. But the
    android
    is displayed as red and
    Unresolved reference: android
    in IDEA, how to make it right?
    • 1
    • 1
  • q

    qlitzler

    03/06/2018, 10:03 AM
    Yes it is possible
    e
    i
    • 3
    • 13
  • g

    gildor

    03/08/2018, 1:39 AM
    Why do you need this
    build.doLast
    task? Looks suspicious
    a
    • 2
    • 15
  • m

    megamiun

    03/08/2018, 5:16 AM
    It seems I can use default on the declaration. What I cant do is call the function with the named parameters
    a
    • 2
    • 3
  • n

    niklas

    03/08/2018, 9:34 AM
    Maybe someone can help me out here? Thanks https://stackoverflow.com/questions/49169537/different-semantics-of-kproperty1t-r-in-js-compared-to-jvm
    • 1
    • 1
  • r

    robstoll

    03/12/2018, 3:21 PM
    I am struggling with intellij, I can build my project with gradle but suddenly intellij throws the following error for my common module
    Error:(3, 1) Kotlin: The feature "multi platform projects" is experimental and should be enabled explicitly
    Anybody had the same experience and can give me a pointer?
    i
    • 2
    • 5
  • n

    natpryce

    03/13/2018, 7:34 AM
    But I find that for libraries, Gradle will still be parsing the build configuration when the Make build has finished.
    g
    • 2
    • 12
  • n

    natpryce

    03/13/2018, 7:38 AM
    Also we find that the caching/incremental compilation in Gradle builds causes frequent build failures. When we pull changes from Git, caches somewhere become inconsistent and the compiler fails with an internal compilation error.
    g
    • 2
    • 3
  • n

    natpryce

    03/13/2018, 7:41 AM
    There are many good build tools, and the kotlin compiler shouldn’t inhibit teams picking the one that’s best for their context
    g
    • 2
    • 3
  • n

    natpryce

    03/13/2018, 6:46 PM
    If any JetBrains dev’s are reading… I already have this building for both JVM and JS platforms without using the language mechanisms for multiplatform. The multiplatform language features and build conventions make it require much more work than necessary.
    m
    i
    • 3
    • 27
  • k

    krtko

    03/15/2018, 11:31 PM
    Hello I am porting part of our Android app to JS via the Multiplatform set up. Its pretty awesome but I am having one issue with the expect/actual set up in JS. I am trying to port over my Json Serialization layer. So I created an Expect Json class like:
    expect class Json {
        fun getInt(id: String): Int
    But with JS, the native Json class is only an interface so implementing it like:
    actual class Json: kotlin.js.Json {
        actual fun getInt(id: String): Int {
            return this[id] as? Int ?: 0
        }
    Does not work. Any suggestions?
    s
    g
    • 3
    • 8
  • k

    krtko

    03/16/2018, 11:48 PM
    A platform module can only import one common module. <Issue resolved> Thanks 🙂
    i
    • 2
    • 19
  • d

    damian

    03/18/2018, 3:42 PM
    I'm just getting started with kotlin so I don't really want to implement my own at this stage. I like the api of this project and it's well tested but has some dependencies on Java that I'm not quite sure how to resolve (particularly references to Class and Generics) https://github.com/MiloszKrajewski/stateful4k
    k
    o
    l
    • 4
    • 6
  • r

    robstoll

    03/21/2018, 9:57 AM
    Who else experience the following problem: When I start debuging from a jvm module and step into code of a common module, then I cannot step further. Intellij starts to update indices like a mad cow and does it over and over again. And if I try e.g. to step over, then Intellij tells me that stepping over is not possibel while indexing 😄 I cannot set any break-points and can only stop debugging, setting all kinds of breaking points beforehand, so that I do not have to step but can always run
  • r

    robstoll

    03/21/2018, 10:00 AM
    ok invalidate cache and restart helped, but now I have another problem. I think I saw that before so it might be a current limitation of intellij. I cannot add a new watch (in debugging). I mean I can add it but it always returns
    unresolved reference: JvmName
    . Should I fill a bug or is this already common knowledge?
    :youtrack: 2
    • 1
    • 1
  • n

    Nail Gilaziev

    03/21/2018, 10:35 AM
    Hello! Who knows, How to write a common module for jvm and js that make a http and json stuffs in it? do I need manually write HTTP and JSON parse classes via expect and actual for now?
    👍 1
    g
    • 2
    • 5
  • y

    yusuf3000

    03/22/2018, 11:17 AM
    I’ve written some unit tests for my common code, but the class I’m testing is internal and it’s throwing an error because of this. The test and the class it’s testing are both in the same package. Is it only possible to test public classes?
    e
    i
    • 3
    • 4
  • a

    albertgao

    03/22/2018, 8:34 PM
    Any mock framework for
    common
    ?
    🇳🇴 1
    g
    • 2
    • 4
  • b

    brabo-hi

    03/23/2018, 4:31 AM
    does anyone have resources about multiplatform architecture in kotlin ? Besides KotlinConf repository
    e
    n
    +2
    • 5
    • 4
Powered by Linen
Title
b

brabo-hi

03/23/2018, 4:31 AM
does anyone have resources about multiplatform architecture in kotlin ? Besides KotlinConf repository
e

elect

03/23/2018, 6:58 AM
I guess to recall @albertgao and @Simone Civetta
n

niklas

03/23/2018, 8:30 AM
@brabo-hi Maybe also have a look at this one: https://github.com/MarcinMoskala/KotlinAcademyApp
s

Simone Civetta

03/23/2018, 9:27 AM
https://github.com/xebia-france/kotlin-ios-framework/tree/feature/multiplatform
a

albertgao

03/23/2018, 10:27 AM
https://github.com/Albert-Gao/kotlin-native-mobile-multiplatform-example
View count: 1