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

    fkrauthan

    03/10/2020, 5:59 PM
    Hey is there any easy way to configure a executable fat JAR for a jvm target in a kotlin multiplatform gradle project (using kotlin DSL)
    k
    • 2
    • 6
  • f

    fkrauthan

    03/10/2020, 7:17 PM
    And to go along with this. Is there any way to apply the application plugin together with the kotlin multiplatform plugin?
    s
    b
    • 3
    • 21
  • f

    fkrauthan

    03/10/2020, 11:11 PM
    And one last issue. I've created a multiplatform project that has
    jvm
    ,
    macosX64
    and
    linuxX64
    as targets as well as a
    commonMain
    with most of my code and a
    posixMain
    source set where macos and linux main source sets are depending on. But for some reason I don't seem to have access to any of the default interops e,g,
    platform.posix
    nether in
    posixMain
    nor in
    linuxMain
    and
    macosMain
    . Is there anything else I need to configure to be able to access them (preferable in my
    posixMain
    source set?
    r
    • 2
    • 13
  • a

    Arthur Brum

    03/11/2020, 12:11 PM
    Hi there! My auto complete features for iOS are gone after updating Android Studio to 3.6.1 Anyone knows any reason to this?
    s
    • 2
    • 1
  • k

    Kris Wong

    03/11/2020, 2:38 PM
    has anyone tried multiple KMP modules in an iOS app yet?
    s
    k
    l
    • 4
    • 7
  • l

    Luoqiaoyou

    03/11/2020, 2:43 PM
    when i import a mpp.framework,i got this error in compile phase. someone can help? i am not familiar with oc and ios
    s
    a
    • 3
    • 3
  • s

    spierce7

    03/11/2020, 3:31 PM
    I keep seeing an error on 1.3.70 when syncing my multiplatform project, that errors our the sync:
    New Gradle Sync is not supported due to containing Kotlin modules
    That’s all the information provided in the IDE, and I can’t repro via command line. Anyone have any idea/
    k
    • 2
    • 18
  • s

    Sebastien Leclerc Lavallee

    03/11/2020, 3:49 PM
    Hello there! I have a kotlin multiplatform sub-project that I want as an application. I did enable the
    application
    plugin and when I
    installDist
    , everything seems to work as expected. I see my app in the build dir and the associated jar file. The problem is when I run the app, I have an error saying it can’t find the main class I did specifiy in my build.gradle. When checking my jar file, it is totally empty. There is only the
    MANIFEST.MF
    . Most of my classes are in the commonMain sourceset and some actual in the jvmMain sourceset. Anyone has encountered this ? Any things to check? Thanks 🙂
    f
    l
    • 3
    • 4
  • s

    spierce7

    03/11/2020, 6:31 PM
    When using the
    ios
    platform target for multiplatform, is it possible to get rid of this error when placing actual declarations in the
    Platform
    file?
    Object ‘Platform’ has several compatible actual declarations in modules ab-testing-firebase.client.iosArm64Main, ab-testing-firebase.client.iosMain
    Object ‘Platform’ has several compatible actual declarations in modules ab-testing-firebase.client.iosX64Main, ab-testing-firebase.client.iosMain
    k
    f
    a
    • 4
    • 5
  • f

    fkrauthan

    03/11/2020, 6:54 PM
    Seems like multiplatform support for actual end binaries/executables is in a even worst state then using it to build libraries to code share between different platforms :(
    a
    a
    • 3
    • 9
  • l

    Luoqiaoyou

    03/12/2020, 9:38 AM
    i got error "Unable to call non-designated initializer as super constructor", when i try to inherit WKWebView in ios.
    a
    • 2
    • 3
  • s

    spierce7

    03/12/2020, 4:41 PM
    I’m in 1.3.70, and even though I clearly have a dependency declared, I’m not able to resolve the coroutines lib when compiling. Has anyone seen this issue?
    Unresolved reference: coroutines
    Unresolved reference: coroutines
    Unresolved reference: CoroutineDispatcher
    Unresolved reference: Dispatchers
    val iosMain by getting {
                dependencies {
                    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinxCoroutines}")
    
                    implementation(Deps.ktor.client.ios)
                    implementation(Deps.ktor.feature.serialization.native)
                }
            }
    k
    b
    • 3
    • 8
  • m

    magnumrocha

    03/12/2020, 5:30 PM
    hello guys, anyone having problems with KMP project build with last version of XCode:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
    k
    • 2
    • 47
  • s

    Shawn Karber_

    03/12/2020, 9:05 PM
    But the fetcher call cannot resolve launch, runBlocking, async, or anything in kotlinx.coroutines. Any ideas?
    s
    r
    • 3
    • 5
  • l

    Luoqiaoyou

    03/13/2020, 8:27 AM
    some strange errors in K/N target IOS string format. when i format string in this way:
    "id:$id,error:$error"
    i got error in runtime.both of them are object pass by ios framework callback. the second way is fine:
    "id:" + id +",error:" + error
    a
    • 2
    • 13
  • c

    CLOVIS

    03/13/2020, 10:31 PM
    I'm on Alpine Linux running JS tests. With
    CHROME_BIN=chromium-browser
    however it complains that
    Running as root without --no-sandbox is not supported.
    . I'm trying to add the
    --no-sandbox
    option, however I can't add it to
    CHROME_BIN
    . Is there an option somewhere in the multiplatform plugin to handle this? And if not, what are the solutions?
    i
    i
    • 3
    • 5
  • a

    altavir

    03/14/2020, 11:22 AM
    @msink I followed your instructions and migrated from bintray to a regular maven-publish plugin. Mostly it works, but there are two problems: • For some reason Bintray treats platform directories as versions and creates versions with names like
    dataforge-meta-jvm
    alongside with normal versions. • When I try to push to a package which did not exist before, I get 404. Do you know some ways around those problems?
    👀 1
    r
    l
    s
    • 4
    • 12
  • c

    coletz

    03/15/2020, 1:38 PM
    Hi everyone, I'm working on an android/ios project. I didn't used mpp in the last few months, so I'm not aware of the state of the art. Is there any way to use generics on kotlin and have them recognized in swift? I remember a draft from kpgalligan about that but I don't know if that's actually implemented in the latest k/n release
    j
    • 2
    • 2
  • d

    dennis

    03/15/2020, 2:24 PM
    Currently trying to setup a Kotlin Multiplatform library, which should make use of another Kotlin (Native) library. The preferred way would be having the dependency as a submodule. Does anyone know if that’s possible and how to approach this?
    r
    • 2
    • 1
  • k

    krtko

    03/15/2020, 7:16 PM
    So I've been using Multiplatform for a while now and I have been enjoying the current set up. I think the features which would help me out the most are 1. Inline platform specific code: Helps onboarding new users and beginners. Helps prototyping and simple platform calls 2. Abstract specific platform code: Helps library creators and reduces nesting 1. Inline platform specific code: Ex.
    //LoginViewController is a pure kotlin class that inherits from the MPP class ViewController. ViewController contains several platform specific fields such as `context` on Android
    class LoginViewController: ViewController {
       fun someButtonWasPressed() {
          //A button was pressed callback
          //uh oh we need to drop into native code for some reason
          android { //An auto generated inlined lambda for the Android MMP
             this.context //we have access to LoginViewController's Android side
             this.androidDoSomething(this.context)
          }
          ios { //An auto generated inlined lambda for the iOS MMP
             NSLog("You have access to anything from the iOS MP project")
             val appDelegate = UIApplication.shared.delegate as AppDelegate
          }
       }
    
       @platform("android") fun androidDoSomething(context: Context) { //can have platform specific arguments
          //this method can only be called from an android context
          Log.d("hi","from android")
       }
       //this could also be nested in some "subclass" like structure like `android { fun androidDoSomething(context: Context) {} }`
    }
    This produces messier and harder to read code in most circumstances, however I think it provides huge benefits in these particular cases: 1. Onboarding new users and beginners. Explaining the current MP project set up is not easy. I think if someone can start a project or contribute to a code base in the fashion above it will be significantly more clear to them. It's also a lot simpler to grasp out of the box vs the Actual/Expect system. Theres no indirection weaving back and forth between the different subproject for each platform. 2. Prototyping. The current Actual/Expect system works very well. It forces you to cleanly separate platform specific code from common code. Thats great except this can get in the way for when you are prototyping something and you just need to get the whole thing running in the most quick and simple fashion possible. I think the above system helps solve that as it reduces the need for nested platform code. 3. Simple platform calls. The current Actual/Expect system adds a lot of overhead for small platform specific methods. If the method is only ever going to be 1-3 lines per platform, its a lot of boiler plate to have a separate file for each platform specific instance of the method ---- 2. Abstract classes with the ability to declare abstract specific platform code: Ex. Library author
    abstract class ViewController {
       @platform("android") abstract fun getView(context: Context): View //even tho we are in common kotlin, the method declaration can access Android
       @platform("iOS") abstract fun getView(): UIView //even tho we are in common kotlin, the method declaration can access iOS
    }
    Library consumer
    class LoginViewController: ViewController {
        @platform("android") override fun getView(context: Context): View {
             //inflate and return a view
        }
    
        @platform("iOS") override fun getView(): UIView {
            val view = UIView()
            return view
        }
    }
    Library authors can currently do something like this by having an Actual/Expect abstract class with specific abstract methods for a given platform. My main issue with doing this is its not as clear to the library consumer and it requires more class nesting than the example above ----
    👍 4
    l
    • 2
    • 14
  • l

    Luoqiaoyou

    03/16/2020, 9:37 AM
    Is there any plan to support cocoapod for ios targets in MPP project?
    t
    • 2
    • 1
  • k

    Kurt Renzo Acosta

    03/16/2020, 2:45 PM
    Hi, folks! Just released my multiplatform paging library for Android and iOS. It uses Architecture Component's Paging on Android and some manual pagination code on iOS. We're using it internally in our projects and I decided to share it with the community since I've had a hard time trying to figure it out. If you're looking for one, please check it out and feedback would be greatly appreciated. https://github.com/kuuuurt/multiplatform-paging Stay safe and take care of yourselves!
    👍 8
    l
    • 2
    • 2
  • j

    Jeff

    03/16/2020, 4:36 PM
    Hello @channel how would you go about using firestore and firebase auth in a multiplatform project? The idea is a news application/blog targeting Android, iOS and Web.
    r
    m
    k
    • 4
    • 11
  • j

    Jan Stoltman

    03/16/2020, 8:38 PM
    Hey, I've heard that ios has problems with handling multiple multiplatform frameworks at once, is it the same with one framework created from multiple gradle modules? Can I split my project into module-per-layer and use it safely in ios project?
    r
    k
    z
    • 4
    • 4
  • s

    spierce7

    03/17/2020, 4:38 AM
    If I have a Kotlin lib that does something asyncronously in the background, and returns a stream of data, what’s the best way to expose that from Kotlin to be consumed from Swift? For Android I’m returning it as a
    Flow
    .
    k
    s
    • 3
    • 4
  • a

    Archie

    03/17/2020, 7:55 AM
    Hi, may I ask how I should deal with Date Serialization in Ktor? Is there an equivalent "LocalDate" or "LocalDateTime" in KMP? If not, how do you guys deal with date?
    d
    m
    r
    • 4
    • 8
  • j

    Joey

    03/17/2020, 8:14 AM
    Hi guys, what would be the best approach if i will be creating AES encryption library for ios and android using Kotlin MP? Because my current idea is to accept the inputs from both platform as bytes and do the AES algorithm manually in the KMP which sounds exhausting. I just wanna know how would you guys tackle this. Thanks!
    r
    • 2
    • 1
  • e

    EvaS

    03/17/2020, 10:43 AM
    Hello, I updated Kotlin to 1.3.70 and so the depencies (ktor, coroutine, serialization). Now the tests are runned on iOSX64 and surprise ! They don't compile I added some dependencies for ios test :
    kotlin_test_junit     : "org.jetbrains.kotlin:kotlin-test-junit:$ver.kotlin",
    kotlin_test           : "org.jetbrains.kotlin:kotlin-test:$ver.kotlin",
    ktor_client_mock: "io.ktor:ktor-client-mock-native:$ver.ktor",
    kotlin_couroutine_test: "org.jetbrains.kotlinx:kotlinx-coroutines-test:$ver.kotlinx_coroutine"
    Now it compiles but some tests fail. I guess it's because my coroutine's dep is wrong (or ktor, I don't know). I have a big trace
    at io.ktor.client
    and
    at kotlinx.coroutines
    Any hint ?
    c
    • 2
    • 14
  • a

    alex009

    03/17/2020, 2:49 PM
    hi all! i built new site for kotlin multiplatform libraries discovery - https://libs.kmp.icerock.dev/ this site is automatically fetch all info from github and maven repository, allow to filter by kotlin version, category and compilation target. If you want to add new library - it's simple (just 3 line in libraries.json and send pull request), read in readme - https://github.com/icerockdev/multiplatform-libraries feel free for feedback and request new libs into list later i will add more libraries, which already linked on http://kmp.icerock.dev/
    🎉 4
    ❤️ 5
    👍 14
    :kotlin: 6
    👏 5
    o
    • 2
    • 6
  • f

    fkrauthan

    03/17/2020, 7:15 PM
    Does anyone know a simple yaml parser library for kotlin multiplatform?
    d
    c
    +4
    • 7
    • 11
Powered by Linen
Title
f

fkrauthan

03/17/2020, 7:15 PM
Does anyone know a simple yaml parser library for kotlin multiplatform?
d

Dominaezzz

03/17/2020, 7:18 PM
https://github.com/charleskorn/kaml
Oops, it's jvm only. Nvm.
c

Casey Brooks

03/17/2020, 7:23 PM
I don’t know of any pure-Kotlin implementations yet. YAML parsers are very complex and difficult to get right, so if there is one out there, I don’t think I would trust it for production use since MPP is so new. I think your best bet would just to use actual/expect declarations over platform-standard libraries
f

fkrauthan

03/17/2020, 9:27 PM
hmm ok yeah I was worried that I have to go down that route
l

louiscad

03/17/2020, 10:04 PM
@charleskorn Since your library depends on kotlinx.serialization which is multiplatform, maybe it could be multiplatform too? Or are you using JVM-only APIs or dependencies?
f

fkrauthan

03/17/2020, 10:30 PM
I though initally its multiplatform but he uses a JVM library for the actual Yaml parsing.
c

charleskorn

03/18/2020, 7:21 AM
I’ve always planned to create a K/N version using
libyaml
(or similar) to do the parsing, but I haven’t gotten around to it yet - biggest blocker is the lack of support for K/N in Spek.
But yes, right now, it’s JVM-only.
m

magnumrocha

03/18/2020, 8:31 AM
this is a good oportunity to make kaml be multiplatform....
and with it contribute to kmp ecosystem.
r

raniejade

03/18/2020, 2:03 PM
@charleskorn I can start publishing the artifacts you need for using Spek in K/N. Biggest downside is that there is no IDE support yet and gradle reporting is via console only (and also blocked by the upgrade to
1.3.70
- significant changes to the compiler plugin api)
View count: 141