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

    Arjan van Wieringen

    04/22/2022, 6:48 AM
    I am having Gradle problems. I can not add serialization in a sub-project, without getting the error:
    Caused by: java.lang.IllegalStateException: The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
    . This is my `settings.gradle.kts`:
    pluginManagement {
        plugins {
            kotlin("multiplatform") version "1.6.21" apply false
            kotlin("js") version "1.6.21" apply false
            kotlin("plugin.serialization") version "1.6.21" apply false
        }
    }
    
    rootProject.name = "scribbles"
    include("dom")
    include("vdom")
    include("web-workers")
    
    include("examples:dom-demo")
    include("examples:vdom-demo")
    And this is my
    web-workers
    gradle:
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization") // <- when commenting out this line it works again
    }
    
    repositories {
        mavenCentral()
    }
    
    kotlin {
        /** targets **/
    }
    Here is the repository: https://github.com/avwie/scribbles/tree/e1629ff6d3e4a322c590d92ba00b740b8f1cf6e6 Am I doing something wrong?
    e
    • 2
    • 2
  • v

    Vivek Modi

    04/22/2022, 9:53 AM
    Hey Guys, I am using sealed class to handle api response. I am trying some code but getting some error. Can somone suggest me? Please see in the thread.
    g
    • 2
    • 6
  • g

    Guilherme Delgado

    04/22/2022, 2:35 PM
    Hello again, I’ve a project with androidApp, iosApp, desktopApp (compose) and shared. All can access to com.repo.domain classes and shared code, except desktopApp:
    dependencies {
        implementation(project(":shared"))
        implementation(compose.desktop.currentOs)
    }
    it gives me an error: “Packages cannot be imported” when I try to import a class. 🤷 IDE suggestion:
    Add dependency on module 'App.shared.commonMain'
    Any idea?
    • 1
    • 3
  • c

    colintheshots

    04/22/2022, 6:35 PM
    I just updated all of my KMM libraries and suddenly I’m getting this error only when building from iOS/Kotlin Native:
    > Task :shared:linkPodDebugFrameworkIosX64 FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':shared:linkPodDebugFrameworkIosX64'.
    > No extensions handle the extension type: kotlinx.metadata.klib.KlibModuleFragmentExtensionVisitor
    Any ideas?
    • 1
    • 2
  • j

    James Black

    04/23/2022, 3:50 AM
    I am working on my KMM backend server and I got this error:
    The 'java' plugin has been applied, but it is not compatible with the Android plugins.
    In my shared build.gradle I have this. If I just use jvm() instead no issues, except it goes to androidMain not jvmMain.
    kotlin {
        android()
        jvm {
            withJava()
        }
    I have a sinking feeling it won't be resolved any time soon based on this issue: https://youtrack.jetbrains.com/issue/KT-30878 Is the best bet to just have web and server have one KMM project and android/iOS and everything else have the other, or should servers just not be in the KMM project currently?
    e
    • 2
    • 11
  • e

    eygraber

    04/24/2022, 8:27 AM
    I just published uri-kmp a uri library for all kmp targets, ported from AOSP's
    Uri
    implementation. Check it out, I'd love to hear your feedback 😄
    💙 1
    b
    d
    • 3
    • 11
  • e

    eygraber

    04/24/2022, 4:47 PM
    Is there any way to disable
    explicitApi
    for test source sets? (edit: looks like it's only an issue for
    androidTest
    )
    x
    • 2
    • 2
  • t

    Tobias

    04/25/2022, 5:39 AM
    Good morning, Where do I see the
    shared
    framework from a KMM project in Xcode? It's neither listed under the
    Frameworks
    folder neither nor
    Embedded Frameworks
    in Xcode.
    n
    d
    • 3
    • 4
  • d

    diego-gomez-olvera

    04/25/2022, 10:37 AM
    hello! How do you share the iOS CocoaPods Pods? I use Artifactory for Android/Java (with maven-publish), so it would be convenient to upload them there as well. I am using cocoapods plugin saw about CocoaPods repositories and cocoapods-art but I cannot find if the setup would require to publish then separate or together for a multiplatform library.
    k
    d
    l
    • 4
    • 13
  • g

    Gopal S Akshintala

    04/25/2022, 5:54 PM
    Hi, I am trying to bundle
    moment.js
    into my jar and this is what I have tried. https://github.com/overfullstack/revoman-root/blob/master/src/jsMain/kotlin/Main.kt But the final bundle generated doesn’t have the moment functions as expected. Am I doing it right?
    b
    • 2
    • 6
  • m

    Matti MK

    04/25/2022, 7:47 PM
    I started a KMM project in fall and now it would be time for another one. In my previous project I did not use the new MM, nor have to worry about M1 issues. However, going into the new project I would like to support M1 and perhaps also use the new MM. With those constraints in mind, are there currently any known pitfalls when it comes to M1 and KMM?
    m
    g
    r
    • 4
    • 6
  • l

    Lucas Schiavini

    04/26/2022, 12:41 AM
    And would a Stop the world pause break the swift UI necessarily?
    r
    • 2
    • 10
  • d

    David Hart

    04/26/2022, 10:16 AM
    I saw that Jetbrains seems to have closed offices in Russia following the war, and I’m wondering if this might have put work on KMM on hold.
    m
    • 2
    • 1
  • l

    lilypuchi

    04/26/2022, 11:36 AM
    I simply moved my
    data
    layer classes along with the dependencies (sqldelight) from
    :shared
    to a new Multiplatform module
    :data
    . But since then, iOS doesn’t build with the following error :
    Undefined symbols for architecture arm64:
      "_sqlite3_column_type", referenced from:
          _co_touchlab_sqliter_sqlite3_sqlite3_column_type_wrapper108 in result.o
      "_sqlite3_bind_parameter_index", referenced from:
          _co_touchlab_sqliter_sqlite3_sqlite3_bind_parameter_index_wrapper84 in result.o
    ...
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':shared:linkDebugFrameworkIosArm64'.
    > Compilation finished with errors
    shared/build.gradle.kts
    looked like this before creating
    :data
    module.
    val commonMain by getting {
                dependencies {
                    implementation("com.squareup.sqldelight:runtime:$sqldelight")
                    implementation("com.squareup.sqldelight:coroutines-extensions:$sqldelight")
                }
            }
    
            val androidMain by getting {
                dependencies {
                    implementation("com.squareup.sqldelight:android-driver:$sqldelight")
                }
            }
    
            val iosMain by creating {
                dependencies {
                    implementation("com.squareup.sqldelight:native-driver:$sqldelight")
                }
                dependsOn(commonMain)
                iosX64Main.dependsOn(this)
                ..
            }
    After creating
    :data
    and moving these dependencies to
    data/build.gradle.kts
    , I just added this in
    shared/build.gradle.kts
    val commonMain by getting {
                dependencies {
                    implementation(project(":data"))
                }
            }
    I haven’t changed anything else. Am I missing out on anything here ? 🤔
    a
    r
    • 3
    • 3
  • r

    ribesg

    04/26/2022, 11:41 AM
    I have a big JVM/Android/iOS multiplatform project with dozens of libs as modules. Let’s say I have a backend developer who wants to make changes to some modules and try these changes locally in their project. Is there an easy way to publish all artifacts for one platform in a multi-modules project or do I need to create custom tasks? Anyone made such tasks? I myself am using
    publishToMavenLocal
    a lot while working (for example) only on iOS and only in the simulator, so I would benefit from this kind of feature
    a
    m
    e
    • 4
    • 13
  • l

    Laxman Sahni

    04/26/2022, 2:36 PM
    Can I consume multiple dynamic Kotlin/Native frameworks in a single iOS application?
    m
    k
    • 3
    • 6
  • v

    Vivek Modi

    04/26/2022, 3:37 PM
    Hey guys, Do you have any good example of Kotlin: Sealed Classes for better handling of API Response in multiplatform?
    t
    m
    • 3
    • 18
  • a

    An Tran

    04/27/2022, 10:39 AM
    Hi guys, how can I use
    String.format
    function in web application? I saw that String in webapplication comes from kotlin-stdlib-js package, and it doesn’t have format function?
    r
    e
    • 3
    • 3
  • v

    Vivek Modi

    04/27/2022, 8:28 PM
    Hey guys what is the difference between of runblocking and suspend function in KMM ?
    b
    g
    • 3
    • 4
  • a

    Alexandre Brown

    04/28/2022, 1:42 PM
    Hello, I'm trying to do mocking in a multiplatform project (jvm, native, common), what is a framework that works well for you guys and if possible works well with kotest. I'm trying out
    org.kodein.mock.mockmp
    , tests and mocking works but building the project fails
    The provided plugin com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar is not compatible with this version of compiler
    so I'm not sure if it's the best framework for now. Any thoughts?
    b
    m
    +2
    • 5
    • 17
  • d

    David Corrado

    04/28/2022, 8:57 PM
    I am looking for an example sample repo which is just the KMM template with just web added. Does not need to be a complicated example just can do the same thing as the KMM template but has web. I have found tons of examples out there where the gradle files look very different so its hard to translate. I would like to stay as close to KMM as possible gradle structure.
    r
    k
    • 3
    • 4
  • p

    pguardiola

    04/28/2022, 10:16 PM
    does anyone know how to make this https://discuss.kotlinlang.org/t/feature-request-typealias-for-expected-types/20054 work? any other ideas?
    k
    • 2
    • 6
  • i

    Ivan Đorđević

    04/29/2022, 9:01 AM
    [SQLDelight, iOS] Hi, my SQLDElight database persists even when I delete and reinstall the app... Does anyone know how to fix this?
    p
    • 2
    • 1
  • v

    Vladimir Malykhin

    04/29/2022, 10:31 AM
    Hi everyone, I migrate to Kotlin 1.6.10 and after when compile iOS project by Xcode get error. But! An error occurs only in release build for iOS, if build into device or simulator - no problem * Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10 * Output kind: FRAMEWORK e: java.lang.NullPointerException at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapClassReferenceType(DataFlowIR.kt:520) at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapType(DataFlowIR.kt:554) at My gradle configure:
    com.android.tools.build:gradle:7.1.2
    org.jetbrains.kotlin:kotlin-serialization:1.6.10
    org.jetbrains.kotlinx:kotlinx-datetime:0.3.2
    org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2
    What could be the reason?
    j
    • 2
    • 11
  • o

    Oleg Yukhnevich

    04/29/2022, 11:37 AM
    Imagine someone (me) wants to create an opensource kotlin multiplatform crypto library with support for JVM, JS(nodejs and browser), Darwin and all other native targets What will you need from it: 1. Hashing - base64, sha*, md5, other 2. encryption: AES, DES, RSA, DH, Salsa20, other 3. TLS 4. key management system (like jvm key managers) 5. certificates - pem, asn.1(der), pkcs12, other 6. PBKDF2WithHmacSHA512 , HmacSHA256 and other unreadablewords 7. something else? For what, do you need to use it and how? Using plain
    ByteArray
    s or `String`s or via some lower level IO streams (like jvm InputStream/OutputStream or multiplatform ones like okio)? What else should I know to make you happy? 🙂
    ❤️ 2
    :kotlin-intensifies-purple: 8
    b
    h
    +2
    • 5
    • 13
  • b

    Bradleycorn

    04/29/2022, 2:52 PM
    Hi everyone! Ii have a KMP project and I’m trying to get it to assemble an XCFramework for ios. I thought I had everything setup right, but when I run the
    assembleXCFramework
    task, I get an error:
    the path does not point to a valid framework: /Users/my.user/dev/wager-utils/build/fat-framework/debug/wager_utils/iosSimulator/wager_utils.framework
    And in looking in the build folder, indeed that path is not correct. Specifically there is no
    wager_utils
    folder. Instead the folder is
    wager-utils
    (dash instead of underscore … see screenshot below). Any idea how that path gets generated, or how I can control it to fix this issue?
    d
    j
    • 3
    • 4
  • m

    Matt Nelson

    04/30/2022, 11:30 AM
    Heyo! I've got a KMP project an am using value classes, but cannot for the life of me figure out how to require their use in Java from an interface method.
    sealed interface Key {
        fun descriptor(address: Address): String
    }
    
    @JvmInline
    value class Address(@JvmField val value: String)
    Calling From Java:
    public class SomeClass {
        public void someFunction(Key key) {
            // Key.descriptor accepts a String, not an Address
            String descriptor = key.descriptor("");
    
            Address address = new Address("someaddress");
    
            // key.descriptor does not accept an Address and IDE shows error
            String descriptor2 = key.descriptor(address);
        }
    }
    Any Ideas?
    g
    m
    • 3
    • 22
  • p

    Paulo Cereda

    04/30/2022, 12:42 PM
    Hi friends! Does anyone know of a MPP library for process execution (similar in behavior to
    ProcessBuilder
    or
    Runtime.exec
    in the Java ecosystem)? Any suggestion is welcome! Thanks! Have a great weekend!
    ➕ 1
    m
    e
    p
    • 4
    • 7
  • v

    Viktor Orlyk

    05/01/2022, 1:49 PM
    Hi, guys. Have one question about plans for multiplatform. Are there any plans to make kmm more full featured like flutter/react native. Searched through roadmaps and comments, but haven’t found anything meaningful. So that three or more years ago it was said that there are no plans for common ui, buy now we have compose multiplatform, so question comes back) thanks
    j
    i
    a
    • 4
    • 6
  • t

    thana

    05/02/2022, 9:52 AM
    is there a way to decalre a dependency on a (gradle) platform like
    testImplementation(platform("io.kotest:kotest-bom:$kotestVersion"))
    inside the source set depdency declaration of a (kotlin) multiplatform project?
    e
    • 2
    • 2
Powered by Linen
Title
t

thana

05/02/2022, 9:52 AM
is there a way to decalre a dependency on a (gradle) platform like
testImplementation(platform("io.kotest:kotest-bom:$kotestVersion"))
inside the source set depdency declaration of a (kotlin) multiplatform project?
e

ephemient

05/02/2022, 10:02 AM
you can work around it for JVM, but not other Kotlin platforms. https://youtrack.jetbrains.com/issue/KT-40489
t

thana

05/02/2022, 10:43 AM
thank you, th worked 🙂
View count: 24