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

    einar

    09/26/2019, 1:06 PM
    Has anyone had success with custom build configurations (those apart from debug and release) together with a MPP shared library? I have a configuration called PreProd that targets a different server url. When trying to build that configuration in iOS I get
    No enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.PREPROD
    . (Im using cocoapods)
    k
    i
    +4
    • 7
    • 17
  • s

    Sylvain Patenaude

    09/26/2019, 1:45 PM
    message has been deleted
    k
    b
    +3
    • 6
    • 30
  • a

    adam-mcneilly

    09/26/2019, 3:25 PM
    Hey y'all, if I have an Android project that's using Room, and I wanted to put some of these model objects into the shared library, I run into some issues because of some of the annotations like ignore/embedded/etc. Would you: 1) Keep the data classes in the Android app and just write a mapping method to parse MPP models? 2) Add the room annotations as
    expect
    values in the MPP and then typealias it to the real thing? I got that idea from seeing how this post handled parcelize:
    <https://aakira.app/blog/2019/04/kotlin-mpp-android-parcelable-en/>
    2️⃣ 1
    l
    j
    k
    • 4
    • 47
  • j

    Justin

    09/26/2019, 5:01 PM
    For testing purposes, I’m adding the ability to read
    *.json
    files into kotlin strings. My project targets JVM, JS, and iOS. My approach was to create a common:
    expect fun readFileToString(file: String) : String?
    And then implement actuals in each target. I have iOS and JVM working, but am not sure of the best way to implement the
    actual
    in JS. Here’s my JVM `actual`:
    import java.io.File
    
    actual fun readFileToString(file: String) : String? {
        return File(file).readText(Charsets.UTF_8)
    }
    Anyone done something like this? I assume I’ll use
    fs.fileReadSync:
    but I’m not sure what I need to import to access that method?
    n
    • 2
    • 1
  • b

    Big Chungus

    09/27/2019, 7:04 AM
    Is there any way to serialize KClass with kotlinx.serialization?
    s
    s
    • 3
    • 5
  • s

    Sebastian Sellmair [JB]

    09/27/2019, 11:57 AM
    Does anyone know, whether or not HMPP already supports having a jvmAndAndroidCommon sourceSet where a jvm and one android target can depend on? 🤔
    k
    • 2
    • 3
  • k

    Kris Wong

    09/27/2019, 1:53 PM
    has anyone setup publishing to Artifactory?
    g
    • 2
    • 4
  • k

    Kris Wong

    09/27/2019, 5:11 PM
    artifactoryPublish.dependsOn assembleRelease
    causes "Could not get unknown property 'assembleRelease' for root project 'FeatureModule' of type org.gradle.api.Project." this is a standard Android task. anyone know why it can't be found?
    • 1
    • 2
  • k

    kpgalligan

    09/27/2019, 7:09 PM
    Thought I’d share this here too. Tried to get as much multiplatform in one place as possible!
    :kotlin-flag: 2
    👍 7
    😍 4
    k
    • 2
    • 1
  • j

    Justin

    09/27/2019, 7:42 PM
    Is it possible to get the root path of the project (as a string) in commonTest?
    b
    r
    • 3
    • 55
  • r

    russhwolf

    09/29/2019, 2:48 AM
    Made this for an internal presentation and thought other folks might find it useful https://github.com/russhwolf/multiplatform-hello
    t
    • 2
    • 1
  • f

    fair_enough

    09/29/2019, 10:30 AM
    Trying to run multiplatform project, getting this error:
    bin/sh -c /Users/userxyz/Library/Developer/Xcode/DerivedData/KotlinIOS-bffkgcwzeqsxgugngfheqfvlzlki/Build/Intermediates.noindex/KotlinIOS.build/Debug-iphonesimulator/KotlinIOS.build/Script-47729E7122F480EB00B9B36B.sh
    ./gradlew: No such file or directory
    Command PhaseScriptExecution failed with a nonzero exit code
    I understand it can't find gradle wrapper. I have project in /projectroot/ and iOS project in /projectroot/native/KotlinIOS Some quick fix or hint?
    g
    • 2
    • 2
  • r

    ribesg

    09/29/2019, 12:49 PM
    So I’m trying to create a big project with JVM backend and some frontends. The JS client project doesn’t build because it doesn’t seem to find the dependencies... Try to build it yourself https://github.com/Ribesg/Kita/tree/feature/init I don’t really understand why it’s looking for those dependencies in the root project’s build folder, and I don’t know if they’re supposed to be there in the first place
    r
    • 2
    • 5
  • x

    Xavier Lian

    09/29/2019, 4:35 PM
    Does multiplatform not support default parmeters in iOS? Kotlin:
    class MyClass(val myParam: String = "default string")
    {
        fun printStuff()
        {
            println(myParam)
        }
    }
    iOS:
    let myClass = MyClass()    //Compiler error: init() is unavailable
    🇳🇴 1
    b
    • 2
    • 4
  • j

    Justin

    09/29/2019, 9:12 PM
    Say I have
    annotation class RunCount(val count: Int)
    open class Testable
    ...and...
    @RunCount(3)
    class TestA: Testable { ... }
    With an instance, like:
    val testA = TestA()
    how can I figure out which annotations it has? For example, I tried this:
    if (testA is RunCount) ...
    But that doesn’t work. Any ideas?
    d
    • 2
    • 14
  • b

    Big Chungus

    09/30/2019, 5:56 AM
    How do I add DOM and Math klibs available for wasm23 target to MPP project via gradle?
    t
    • 2
    • 13
  • n

    Nikky

    09/30/2019, 6:55 AM
    i am trying to run junit5 tests in my multiplatform project, but it seems like events are not received, does anyone know a complete example that got this working ? or can you not throw
    @Test
    on global functions ?
    t
    • 2
    • 3
  • b

    Big Chungus

    09/30/2019, 3:21 PM
    Is there a way to exclude one of the MPP targets from common module? i.e. JS & WASM targets depend on common, but not JVM
    g
    • 2
    • 4
  • m

    Miguel Fermin

    10/01/2019, 2:05 AM
    Hi all, I'm trying to make a POST http request using
    ktor
    , I followed a tutorial that how to make a GET, but I feel like I'm missing something fundamental for the POST. This is the error I'm getting:
    kotlin.String cannot be cast to io.ktor.client.call.HttpClientCall
    any ideas or tutorial I could follow. Thanks in advance!
    j
    • 2
    • 2
  • p

    prgrm-me

    10/01/2019, 9:17 AM
    i am receiving a lot of
    Unresolved reference
    to various packages, like coroutines, ktor, serialization. Everything looks divine in build.gradle, dependencies are correct for each platform. Why it happens, and how to completely resolve it?
    k
    a
    s
    • 4
    • 5
  • l

    Lou Morda

    10/01/2019, 6:35 PM
    In an Android + iOS multiplatform app using MVVM with a Repository layer in between ViewModel and data layers, is it better to call CoroutineScope.launch { } in order to get a list of displayable data in the 1. ViewModel layer, or in the 2. Repository layer?
    a
    • 2
    • 2
  • f

    FranGSierra

    10/02/2019, 11:26 AM
    Hello! I'm trying to find out on the official documentation some help to build the interop of some cocoapods libraries imported on KTnative code and im getting some troubles when generating the headers for the iOS code. In this case I'm trying to generate the headers for Firebase Auth and Firebase Core Pods. But the headers generated on ObjC are missing all the inside headers of the library. Example:
    FirebaseCore.h
    is correctly generated but I need the reference of
    FirebaseCore/FIRLogger.h
    aswell to allow my swift code to call my sharedModule methods. Im getting this trace when the task
    app:cinteropLibraryNameIos
    is called
    Exception in thread "main" java.lang.Error: /Users/minuscorp/Documents/kotlin-native-poc/iosApp/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h:19:9: fatal error: 'FirebaseCore/FIRLoggerLevel.h' file not found
    a
    • 2
    • 11
  • a

    Alistair Sykes

    10/02/2019, 1:31 PM
    Hey folks, I came up against this issue and thought I’d share the solution: Running iOS tests within my multiplatform project uses
    xcrun simctl spawn
    command. I started getting an error when launching emulators -
    domain=com.apple.CoreSimulator.SimError, code=165
    xcrun simctl spawn
    after XCode 11 doesn’t run in standalone mode by default. To fix you need to add
    --standalone
    option. This option was available since XCode 6 so should be safe to add now wherever needed. But you will only start to see this issue after upgrading to XCode 11.
    👍 4
    r
    s
    • 3
    • 2
  • s

    spierce7

    10/02/2019, 7:22 PM
    I think I remember there being a way from kotlin common to access the equivalent of
    System.currentTimeMillis()
    . I can’t find it anywhere though. How do I do this?
    k
    a
    +3
    • 6
    • 15
  • s

    spierce7

    10/02/2019, 8:31 PM
    How can I set free compiler args on a Kotlin multiplatform module?
    l
    • 2
    • 6
  • y

    yshrsmz

    10/03/2019, 4:02 AM
    Anyone here tried Android Studio 3.5.1 ? Sync fails everytime if I open Kotlin Multiplatform Project
    l
    a
    +2
    • 5
    • 8
  • b

    Big Chungus

    10/03/2019, 8:29 AM
    My common module's tests used in JS target are compiled but not executed. Having assertion in the tests like
    assertTrue(false)
    still does not fail my test runs with
    ./gradlew check
    . Any suggestions on how to resolve this?
    j
    • 2
    • 8
  • k

    Konstantin Petrukhnov

    10/03/2019, 9:17 AM
    Is there any example of Worker with class that have mutableMap inside it, and allow to add/remove entries from different BG threads in ios? Only one worker will try to access data at a time, but because of ios, it could be from different threads.
    a
    o
    • 3
    • 3
  • j

    Jan Stoltman

    10/03/2019, 9:27 AM
    Is there any library which provides some kind of an abstraction over view stacks of mobile platforms for multiplatform?
    b
    a
    • 3
    • 4
  • b

    Big Chungus

    10/03/2019, 3:03 PM
    I'm about to finish MVP version of my Virtual DOM multiplatform library available for COMMON, WASM & JS. The end goal is full DOM isolation in WASM, allowing to use Kotlin to develop WASM-Only webapps. Here's the repo if you're interested: https://gitlab.com/lt.petuska/kvdom
    l
    n
    • 3
    • 9
Powered by Linen
Title
b

Big Chungus

10/03/2019, 3:03 PM
I'm about to finish MVP version of my Virtual DOM multiplatform library available for COMMON, WASM & JS. The end goal is full DOM isolation in WASM, allowing to use Kotlin to develop WASM-Only webapps. Here's the repo if you're interested: https://gitlab.com/lt.petuska/kvdom
Currently it has a low-level DOM tree representation and diffing implemented (excluding event hadles). There's a kvdom-sample subproject if you want to see it in action. I was able to implement even main function in common module.
And as always, ideas & merge requests are welcome
l

louiscad

10/03/2019, 3:34 PM
Is there an example webpage online to see how it works in our browsers, including mobile devices without having to build?
b

Big Chungus

10/03/2019, 3:35 PM
Not at the moment. It's still unreleased as i want to implement event handles as well before i go live with mvp
But the sample build is pretty quick
n

napperley

10/04/2019, 2:37 AM
Curious as to how you are handling WASM when Kotlin's WASM support is very limited (eg no interop with JS libraries).
b

Big Chungus

10/04/2019, 5:08 AM
I'm creating my own js interop. It's a tedious job, but i see a great value in a library as such. Especially for wasm
Have a look at the wasm module and you'll see
Here's prebuild WASM sample. Just serve the directory with any http-server
kvdom-wasm-sample.zip
View count: 2