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

    dai

    11/02/2018, 3:30 PM
    Just starting to look at kotlin multiplatform - what ide is everyone finding best to use? AS/IntelliJ/.. ??
    l
    s
    p
    • 4
    • 3
  • a

    addamsson

    11/03/2018, 2:00 PM
    you can use coroutines on the native platform, no?
    p
    r
    g
    • 4
    • 6
  • j

    josephivie

    11/03/2018, 4:53 PM
    kotlinx.serialization isn't working with enums on native and is missing polymorphic deserialization on JS and native I just made one that was really flexible. Standard is great, but the standard doesn't work the whole way yet. I've looked at your stuff @louiscad for Android, I like where you go with it. I'll have the GUI one up soon. To my understanding, reactive programming is about making a flow of execution that is consistent and based upon rules, such as "when X changes, do Y". The whole thing is written for Common only, and as such should work on every platform. It has no understanding of threading, and doesn't necessarily need it to be useful. You're meant to rely on coroutines, where smarter people than me can find solutions. Also, the whole thing is built for programming on JS as well, which has no threads at all. Perhaps calling it a data binding library would be more accurate?
    p
    • 2
    • 2
  • j

    josephivie

    11/03/2018, 5:35 PM
    Gradle plugin that reads source code and
    kotlin_metadata
    files.
    e
    • 2
    • 8
  • j

    josephivie

    11/03/2018, 5:57 PM
    But the runtime is missing things too, unfortunately. Like polymorphism, which is absolutely critical to what I'm doing right now.
    p
    • 2
    • 2
  • j

    josephivie

    11/04/2018, 6:58 AM
    And I'm done for the night. Come Monday I'll get back to it.
    l
    • 2
    • 1
  • a

    addamsson

    11/04/2018, 10:17 AM
    kotlin will figure out which project to choose
    h
    • 2
    • 3
  • a

    addamsson

    11/04/2018, 6:16 PM
    Is there someone who knows how to release Kotlin multiplatform projects to Maven Central using the new
    kotlin-multiplatform
    plugin?
    t
    h
    j
    • 4
    • 31
  • s

    sendoav

    11/05/2018, 2:50 PM
    Hi, is it possible to link one kotlin-platform-common to another kotlin-platform-common? Appart from adding the dependency in gradle, does it need any special configuration? All the objects from the linked module throw “Unresolved reference” when building the complete app..
    t
    • 2
    • 1
  • k

    kpgalligan

    11/05/2018, 9:31 PM
    So, all slack group. Is anybody putting multiplatform in production for mobile, including native? Also interested in web, but I'm giving a talk that will focus more on mobile in a couple weeks. Would love to highlight some stories.
    a
    c
    • 3
    • 11
  • a

    addamsson

    11/06/2018, 9:14 AM
    I have been releasing multiplatform stuff to MC with the old architecture but with this new one it doesn't work. MC only accepts artifacts which have sources jar and javadoc jar and I can't create a javadoc jar out of a common project. With the old way I just released each platform-specific implementation by hand but with
    kotlin-multiplatform
    this is not an option because they are not separate projects in Gradle.
    h
    • 2
    • 23
  • a

    addamsson

    11/06/2018, 10:13 AM
    Where can I find the source code of the
    kotlin-multiplatform
    plugin?
    h
    • 2
    • 1
  • p

    patjackson52

    11/06/2018, 1:16 PM
    For MPP library packaging and distribution, what will that look like? Seems like a few scenarios: 1) pure kotlin source(no target deps, no actual implementations) which is imported in the common sourceSet. (kolin-stdlib may be example?) 2) Libraries that contain expect and actual implementations. These require an artifact for common and each platform. Looks like all of these can be host with maven/jcenter/etc. Curious, does the kotlin compile to native with a jar file? does the compiler take class files and then transform them into IR before compiling into native? Any good reads or documentation around this? For scenario #1 can we simply publish a jar to maven in the typical way without any target deps and have that work in a MPP project?
    h
    • 2
    • 6
  • a

    addamsson

    11/06/2018, 2:30 PM
    Do any of you have experience setting up the
    kotlin-multiplatform
    plugin using Kotlin script (
    build.gradle.kts
    )? I have been struggling with this for quite some time now but I can't set this up properly:
    plugins {
        id("org.jetbrains.kotlin.multiplatform")
    }
    
    kotlin {
        targets {
            
        }
    }
    IDEA properly recognizes the
    kotlin
    method but there are no docs about how to set it up even with the basic example we have:
    targets {
        fromPreset(presets.jvm, 'jvm')
        fromPreset(presets.js, 'web')
    
        configure([jvm]) {
            tasks.getByName(compilations.main.compileKotlinTaskName).kotlinOptions {
                jvmTarget = '1.8'
            }
            tasks.getByName(compilations.test.compileKotlinTaskName).kotlinOptions {
                jvmTarget = '1.8'
            }
        }
    
        configure([web]) {
            tasks.getByName(compilations.main.compileKotlinTaskName).kotlinOptions {
                sourceMap = true
            }
        }
    }
    there is no
    fromPreset
    method for example defined on
    KotlinTarget
    so I'm a bit puzzled.
    r
    l
    +2
    • 5
    • 25
  • n

    Nikky

    11/06/2018, 8:11 PM
    atm i am forced to use gradle 3.3, so i think i will try this for a new project in the future
    😢 4
    g
    • 2
    • 1
  • n

    Nikolai

    11/07/2018, 3:36 AM
    Hi, everyone I used MutableLiveData in Android development, does anyone know any equivalent in kotlin-native that can be used in multiplatform development? To implement similar behavior - observable variable.
    g
    k
    j
    • 4
    • 10
  • p

    patjackson52

    11/07/2018, 6:12 PM
    Are there limitations on what is available from in Swift in MPP project? In common kotlin code I have some top level functions and vals. They do not appear to be accessible from swift.
    r
    t
    o
    • 4
    • 4
  • n

    Nikolai

    11/08/2018, 4:37 AM
    Hello, everyone Maybe silly question but I am not very familiar with Gradle. I am using IDEA, selecting : new project - kotlin- mobile shared library. Because according to description this type of project allow to share code between jam/Android and Native. At the start ide create to targets : iOS and jvm, it’s okay, but I want to use Android classes in jvm module (like SharedPreferances) to implement platform specific solution. But I can’t do it. How I can achieve it? I saw different projects that implement such behavior, but they use different project structure, I don’t really understand how to apply it here. I rad docs about multi platform projects on kotlinlang.org and found that they have different target types, including ‘android’. But when I try to add new target using : ’fromPreset(presets.android, ‘library’)’ I got error : ’Extension with name ‘android’ does not exist.’. I tried to follow this error and tried to solve it (adding gradle plugin, setting up different keys and sections in build.gradle file), but it always lead to kind of chaos in project at the end and I still can’t use android classes in jvmModule. Can someone please explain me how I can use android classes to implement platform specific implementation of common module? I put project what IDEA created here, in case you will need to see sources (https://github.com/nbaklanov-issart/multiplatform-prg-example). What I need to do? Add another target? Or depency? Or something else.
    g
    • 2
    • 3
  • p

    pajatopmr

    11/08/2018, 9:12 AM
    I have yet another early attempt at a Kotlin multiplatform library (JVM, JS, macos since they are the default from Intellij’s multiplatform library (current) template) up on Github at https://github.com/pajato/ArgusCoreKML . The important feature for this piece of work is code coverage. Only the JVM has support for code coverage (via Jacoco) via the Gradle task jacocoJVMTestReport. This effort shows 100% covered code implemented using clean code/clean architecture approaches. Note that only JVM and macos tests run. Not sure what the issue with JS is yet. That issue and both Android and iOS support will be addressed next.
    j
    a
    k
    • 4
    • 7
  • y

    yusuf3000

    11/08/2018, 4:25 PM
    How do you use the
    apply from
    syntax in a
    build.gradle
    file using the new multiplatform plugin? I’m getting an error on this line:
    apply from: '../../../gradle/jacoco.gradle'
    k
    • 2
    • 2
  • a

    addamsson

    11/08/2018, 8:39 PM
    How do I make project dependencies transitive when using the
    kotlin-multiplatform
    plugin? My understanding was that I should use
    api
    in my
    build.gradle
    like this:
    jvmMain {
                dependencies {
                    api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
                    api libraries.kotlin_reflect
                    api libraries.caffeine
                    api libraries.snakeyaml
                    api libraries.slf4j_api
                    api libraries.slf4j_simple
                    api libraries.trie_map
                }
            }
    But when I reference this multiplatform project in another project in my multi-project build:
    dependencies {
        compile project(":zircon.core")
    
        compile libraries.kotlin_stdlib
        compile libraries.filters
    
        testCompile libraries.junit
        testCompile libraries.mockito
        testCompile libraries.assertj
    }
    and publish this to a repository, when I add my project as dependency:
    dependencies {
        compile "org.hexworks.zircon:zircon.jvm.swing:$version"
    }
    only the contents of the
    org.hexworks.zircon:zircon.jvm.swing
    are added to the classpath and I can't see stuff from
    zircon.core
    . What could be the problem?
    j
    • 2
    • 3
  • n

    Nikolai

    11/09/2018, 6:16 AM
    Hi, everyone Another simple question, I guess. I am trying to solve it, but can’t understand what I am doing wrong. I am using IDEA, selecting : new project - kotlin- mobile android/ios. And get the default project. After that I want to import ktor (to implement client-server connection). I added :
    maven { url "<https://dl.bintray.com/kotlin/ktor/>" }
    to repositories list. Then I went through all sourceSets and add:
    implementation "io.ktor:ktor-client-core:1.0.0-beta-3"
    - for common module
    implementation "io.ktor:ktor-client-android:1.0.0-beta-3"
    - android
    implementation "io.ktor:ktor-client-core-ios:1.0.0-beta-3"
    - ios run “assemble” task of the gradle, everything ok. After that I add some simple code to common module:
    private val client = io.ktor.client.HttpClient()
    (btw I didn’t get any autocomplete or suggestions from IDE, but at least after I entered whole line it was ok). After that I tried to run “assemble” again, but got an error :
    z
    • 2
    • 2
  • n

    Nikolai

    11/09/2018, 6:17 AM
    Looks like am doing something wrong and iOS module didn’t recognize ktor, even after I added needed dependency. (here is my project in github, I messed up with gitignore, but still it’s not so big : https://github.com/nbaklanov-issart/ktorTry) Do I missing something? Do I need to add or set something else?
    o
    e
    • 3
    • 4
  • s

    Sabrina Namur

    11/09/2018, 10:43 AM
    Hi, i want to add unit test to my multiplatform project. I'm using the new stucture with Mobile iOS/android. Is it possible to write unit tests in commonTest module? If so how do I do that?
    j
    t
    • 3
    • 9
  • s

    Slackbot

    11/10/2018, 3:31 PM
    This message was deleted.
    r
    k
    r
    • 4
    • 7
  • n

    Nikolai

    11/12/2018, 5:51 AM
    Hello, everyone Did someone tried to use ktor JsonFeature in multiplatform project? Is it available for mp projects? I have following code in common module :
    private val client = io.ktor.client.HttpClient() {
            install(JsonFeature) {
                serializer = io.ktor.client.features.json.defaultSerializer()
            }
            expectSuccess = false
        }
    And during asseble compileKotlinIos fails with : error: unresolved reference: JsonFeature. Do I need to add additional dependency in iOS module, or this feature is not for multiplatform? P.S. I tried to search something like : io.ktor:ktor-client-ios-json but no luck.
    g
    k
    +2
    • 5
    • 10
  • k

    kpgalligan

    11/12/2018, 6:37 PM
    I've been using gradle-bintray-plugin:1.8.2-SNAPSHOT from https://dl.bintray.com/jetbrains/kotlin-native-dependencies to publish multiplatform and native artifacts with metadata. This works for 4.7, but updating to 4.10 blows up the 1.8.2-SNAPSHOT. Using bintray's 1.8.4 doesn't seem to understand modules and metadata. Anybody poking around this stuff and have solutions?
    r
    • 2
    • 7
  • a

    addamsson

    11/12/2018, 6:39 PM
    it works out of the box
    k
    t
    • 3
    • 14
  • p

    patjackson52

    11/12/2018, 11:40 PM
    Anyone know of a MPP with JS tests in the shared module? I know to add the actual tests, but unclear on how to set up to run them
    s
    • 2
    • 2
  • a

    addamsson

    11/13/2018, 7:36 AM
    Do you plan to add a cross-platform assertion library?
    j
    j
    • 3
    • 4
Powered by Linen
Title
a

addamsson

11/13/2018, 7:36 AM
Do you plan to add a cross-platform assertion library?
j

joseph_ivie

11/13/2018, 4:24 PM
What exactly do you mean? For testing, I have made a virtual view implementation to make unit testing views easy. As for mocking, like, mocking a server, I have a trick up my sleeve - instead of mocking the server, use an instance of the actual server. They are all written in Kotlin after all! Granted, I've left another system in place such that you could manually mock the server.
a

addamsson

11/13/2018, 6:56 PM
Something like http://joel-costigliola.github.io/assertj/
j

josephivie

11/13/2018, 7:39 PM
I'll think about it. If I do, it will be a fairly minimalistic extension to Kotlin's testing, as my goals with my libraries are to add the minimum number of declarations to make a task convenient and maximize the use of things in the standard library.
👍 1
a

addamsson

11/13/2018, 8:43 PM
That's a nice idea!
View count: 6