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

    kpgalligan

    07/03/2018, 9:53 PM
    For 2, I'm not sure what you're trying to do.
    e
    • 2
    • 2
  • e

    Edouard Goossens

    07/05/2018, 2:32 PM
    I’m experimenting with a project structure where a Ktor app uses two multi-platform modules (JVM . When I include only one module, it works fine, but when I include the second one, I get ClasssNotFoundException errors. I created a reproducible example at https://github.com/egoossens/testmulti What am I missing? Thanks!
    • 1
    • 2
  • m

    marcinmoskala

    07/06/2018, 3:20 PM
    I have in my multiplatform project both
    common
    and
    common-client
    . I added
    common-native
    and I wanted to add
    common-client-native
    . The other one works if i make it as expected by both common modules:
    dependencies {
        expectedBy project(':common')
        expectedBy project(':common-client')
    }
    But I would prefer to reuse declarations from
    common-native
    like in other platforms:
    dependencies {
        compile project(':common-native')
        expectedBy project(':common-client')
    }
    This gives me the following error:
    Could not find method compile() for arguments [project ':common-native'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
    Similarly
    compileKonan
    .
    l
    • 2
    • 2
  • b

    bkenn

    07/10/2018, 7:01 PM
    Has anyone had trouble with type aliasing java annotations with values? I tried to find some examples in the kotlin library but couldn't find any. For instance I have have in common an annotation such as
    expect annotation class NodeEntity(val label: String = "")
    and on the jvm target
    actual typealias NodeEntity = org.neo4j.ogm.annotation.NodeEntity
    . The annotation I want to type alias has one field definition of
    String label() default "";
    . I am getting
    Parameter 'label' has conflicting values in the expected and actual annotation
    .
    u
    • 2
    • 2
  • g

    gaetan

    07/19/2018, 11:07 AM
    I did it manually by adding gradle build files to a bigger project. You have to use :``` apply plugin: 'kotlin-platform-android' ```
    👍 1
    b
    • 2
    • 3
  • k

    krtko

    07/24/2018, 11:29 PM
    Hey all, do you use any web frameworks with Kotlin? I have been developing my own with the idea of having abstracted ViewControllers, Routing, etc in a multi-platform way. Basically Everything is cross-platform except for the views. Would anyone be interested in this? I didn't originally plan on open sourcing it since I figured it would be to custom tailored to my own requirements. Also I figured most ppl use either React or Angular, which I am not a fan of and my approach might be to much like an iOS/Android app for web developers.
    👍 2
    n
    o
    j
    • 4
    • 11
  • k

    krtko

    07/25/2018, 11:33 PM
    One of the pain points I have with the Mutli-platform expect/actual API, is insuring a consistent modality of the classes. For example I have
    expect class View
    and in JS I set the view to be
    HTMLElement
    (an abstract class) and on Android I need it to be
    FrameLayout
    (a plain class)
    • 1
    • 2
  • j

    jw

    07/25/2018, 11:44 PM
    i'm not sure that's a good use of it. you would actual/expect adapters to the native platform UI but not the actual native UI types themselves
    k
    u
    • 3
    • 4
  • j

    josephivie

    07/26/2018, 6:12 PM
    Work in progress, external reflection plugin for Kotlin multiplatform - https://github.com/UnknownJoe796/kotlinx-reflect-plugin Depends on implementations in https://github.com/UnknownJoe796/kotlinx
    o
    • 2
    • 3
  • v

    vmichalak

    07/27/2018, 9:43 AM
    Hi guys, i currently attempt to work on a multiplatform HTTP Client for Kotlin. JS and Java works for the moment but perhaps not in the most optimized way. Any people interessed to help me on this ?
    o
    t
    k
    • 4
    • 15
  • v

    vmichalak

    07/27/2018, 5:17 PM
    Another question: Is there a multi-platform UI framework project for kotlin ?
    t
    k
    +4
    • 7
    • 18
  • n

    napperley

    07/30/2018, 11:52 PM
    Have encountered a strange issue when building a JAR for a Common lib via Gradle. Every time the JAR is created it only contains the manifest file.
    • 1
    • 2
  • n

    napperley

    07/31/2018, 12:00 AM
    Publishing the library fails with this error: Unable to find method 'kotlin.reflect.jvm.internal.KClassImpl.getMembers(Lkotlin/reflect/jvm/internal/impl/resolve/scopes/MemberScope;ZZZ)Lkotlin/sequences/Sequence;'.
    Common_Lib_Build_File.kt
    j
    • 2
    • 2
  • a

    apomelov

    07/31/2018, 7:59 AM
    Hi. Got stuck a bit with the terminology (common-platform-regular modules). I currently have two modules in my project: server and client (web). Server is written in kotlin and being built like a regular kotlin jvm application. Client is written in javascript and being build with webpack using node.js gradle plugin. Now I'd like to share some models and validation logic between client and server. I need a "common module" for this. I have no platform specific stuff there. So are my original modules platform or regular? What kind of dependencies should be there? Building a common module probably should produce some JS code to be used in client, but I can't see corresponding gradle tasks after applying platform-common plugin (only compile to JVM is available). What am I missing here?
    r
    i
    • 3
    • 16
  • k

    krtko

    07/31/2018, 4:55 PM
    When I create a new multi-platform module in the IDEA, it just creates an empty module. I am using Gradle as my build system. UPDATE: If I add the module manually to my settings.gradle file then add a new multi-platform module, it then assembles the previous module but not the one that was just added.
    :youtrack: 1
  • e

    eddie

    08/01/2018, 7:33 PM
    Name overrides are one thing, and you could provide a generic
    @TargetName
    annotation for that. I'm referring more to also exposing things like @JvmField, @JvmStatic, @JvmOverloads, etc. Why do those belong in common code?
    r
    a
    • 3
    • 7
  • k

    kpgalligan

    08/03/2018, 2:03 PM
    Just published the Droidcon NYC app, which is Android/iOS multiplatform. There's quite a bit of duct tape in there, but it works: https://twitter.com/kpgalligan/status/1025379360910573574
    👍 1
    👏 7
    t
    r
    • 3
    • 13
  • r

    russhwolf

    08/05/2018, 12:19 AM
    Been incrementally updating my multiplatform-settings library, and I just pushed a new version https://twitter.com/RussHWolf/status/1025897215787769856
    🎉 3
    👍 3
    k
    • 2
    • 12
  • a

    apomelov

    08/07/2018, 9:59 AM
    Hi. I'm reading code of the kotlinconf-app and can't understand one thing. The web client module contains this:
    afterEvaluate {
        copyKotlinJs.dependsOn copyDependenciesKotlinJs
    }
    But I can't find where does task
    copyDependenciesKotlinJs
    come from? Seems my project has the plugins applied, but there is no such task.
    a
    • 2
    • 2
  • a

    apomelov

    08/07/2018, 10:23 AM
    Actually, the example is based on kotlin 1.2.0.. And also I found kotlin-frontend-plugin that has kotlin-plugin 1.1.61 as a dependency. Seems everything is quite old. Is there some newer approach to simplify the configuration of my js modules? To hide dependency management and node installation? Kotlin-frontend-plugin seems to be the thing, but too outdated.
    a
    • 2
    • 5
  • p

    pabl0rg

    08/09/2018, 1:54 AM
    would it be possible to add Flutter as a multiplatform target via dart’s native extensions? https://www.dartlang.org/articles/dart-vm/native-extensions
    o
    • 2
    • 2
  • j

    Jurriaan Mous

    08/09/2018, 7:21 AM
    I rather hope that there will be a Flutter/React like API based on a Kotlin DSL that is cross platform. That it is also possible to mix it with native UI elements which is not possible in Flutter. It should be possible to create one based on Yoga on native and Android (https://yogalayout.com which is also used by React Native) and with CSS on web.
    ☝️ 1
    ➕ 3
    p
    j
    • 3
    • 7
  • k

    kenkyee

    08/09/2018, 8:06 PM
    multiplatform always sounds like a good (especially to PHBs that think they can cut down on work and developers), but actual implementation is full of potholes and surprises...usually tooling is much weaker than apps done in native platform tools and you end up getting slowed down a lot...or you have these weird inconsistencies that make it really write once, test everywhere, fiddle on each platform to get it to work, add workarounds on each platform, etc. This has happened time and time again...Java, Xamarin, R/N, etc.... I take any new attempt w/ a big grain of salt 😉
    n
    • 2
    • 2
  • o

    orangy

    08/09/2018, 10:12 PM
    I think if we had a K/N, K/JS sample interoping that would be nice. Anyone? 😄
    👍 1
    n
    • 2
    • 1
  • k

    kpgalligan

    08/09/2018, 10:16 PM
    A lot of the tricky stuff in K/N is, imho, thread related, which isn't an issue for you now anyway. I haven't quite convinced clients to bite yet, but there really are a few critical missing pieces, at least for mobile. Coming soon.
    n
    • 2
    • 1
  • a

    ankushg

    08/09/2018, 10:17 PM
    Touche, maybe the time I'm spending on filing JS tickets (and asking stupid questions) would be better spent on getting Native working and filing tickets and asking questions there 😛
    n
    • 2
    • 1
  • k

    kpgalligan

    08/09/2018, 10:21 PM
    I'm also speaking next week in Virginia next week and haven't started the slides.
    o
    • 2
    • 4
  • o

    orangy

    08/09/2018, 10:26 PM
    The worst possible strategy is waiting for “JB folks to figure it out” and then “I’ll see if I like it”
    👍 7
    r
    • 2
    • 4
  • a

    ankushg

    08/10/2018, 10:02 PM
    Has anyone successfully used Gradle's composite builds to include KMPPs in an Android project? I'm trying to avoid needing a private maven repo to publish my artifacts for the time being and just using
    git submodule
    so I can keep developing while we figure out private repo options. The IDE doesn't maintain the nesting of my projects in my KMPP and complains that `actual`s in my JS/JVM platform projects don't have corresponding `actual`s (they do), and that they can't use certain methods because they're
    internal
    to the
    common
    module...
    t
    • 2
    • 3
  • h

    hmole

    08/12/2018, 9:27 PM
    Is there a lightweight(not kotlinx.serializaion) library to simply parse json string one way into Maps/Lists for multiplatform?
    t
    s
    j
    • 4
    • 13
Powered by Linen
Title
h

hmole

08/12/2018, 9:27 PM
Is there a lightweight(not kotlinx.serializaion) library to simply parse json string one way into Maps/Lists for multiplatform?
t

thevery

08/12/2018, 10:59 PM
Create your own with expect/actual, it takes about 30-50 lines per platform for iOS/Android
h

hmole

08/13/2018, 8:34 AM
I need it for JS also. Guess it's time to write my own json parser.
s

sandwwraith

08/13/2018, 9:39 AM
you can start from here: https://github.com/Kotlin/kotlinx.serialization/tree/master/json it is json parser in separate module; however, binary artifacts for it on JVM/JS are not published (they’re part of a bigger kotlinx.serialization). Probably you want to cut-and-paste it or make your fork with publishing.
👍 1
h

hmole

08/13/2018, 10:15 AM
Thanks, will look into it.
What's the purpose of
CharArray.createString(length: Int): String
? Why not just do
String(buf)
?
s

sandwwraith

08/13/2018, 11:04 AM
There was no such constructor at that time: https://youtrack.jetbrains.com/issue/KT-23356
j

josephivie

08/13/2018, 9:24 PM
If you're willing to do a little work, you could always make something based off this - https://github.com/cbeust/klaxon/blob/master/src/main/kotlin/com/beust/klaxon/JsonReader.kt You'll have to replace the parts the represent the JVM with others though.
Also, I've already done some of that work if you want to pull from mine. Pull in RawJsonReader and RawJsonWriter from here: https://github.com/UnknownJoe796/kotlinx/tree/master/kotlinx-common/src/main/kotlin/com/lightningkite/kotlinx/serialization/json
t

thevery

08/13/2018, 10:03 PM
Looks like there is some need in expect/actual json parser for 3 platforms
s

sandwwraith

08/13/2018, 10:40 PM
Not sure why
kotlinx.serialization
is not “lightweight”. Btw, I think even if you include it without plugin, you’ll be able to do parsing to maps.
t

thevery

08/13/2018, 10:56 PM
The main problem for me at the moment is binary incompatibility for KN updates so I have own source-based library
s

sandwwraith

08/13/2018, 11:19 PM
what do you mean? it’s updated to 0.8.1 and probably shouldn’t face issues even with recent dev build
h

hmole

08/14/2018, 7:31 AM
I already pulled out classes from
kotlinx.serializatoin
, and wrapped it in a library Exactly what I needed.
View count: 4