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

    ariedov

    07/08/2022, 4:44 AM
    Are there any
    cbor
    implementations other then the
    kotlin.serialization
    ? I am looking for something implementing RFC 8949 https://www.rfc-editor.org/rfc/rfc8949.html Native android and ios solutions would also work for me.
    b
    • 2
    • 2
  • r

    Racka N

    07/08/2022, 3:52 PM
    Hello everyone. So, I was having an issue with dependency resolution not working. Which is related to this: https://youtrack.jetbrains.com/issue/KTIJ-22111 The current solution was staying on Bumblebee or Intellij IDEA 2021.3 with AGP 7.04. This has worked perfectly for quite a while but now even Intellij IDEA 2021.3.1 and AS Bumblebee do not work. I'm using Windows 11. I have 2 Multiplatform projects and no dependencies in commonMain or androidMain are being resolved with Intellij IDEA 2021.3.1 (only those is jvmMain and jsMain work). In Bumblebee they all get resolved but break when you build and run the project (they start working again after you manually resync gradle). In Intellij IDEA 2022.2 EAP7, AS Chipmunk and Dolphin (which are know to have this issue), import for things originating from commonMain do not work inside commonMain or androidMain for all imported multiplatform libs (either from another module within the project or downloaded) Now, the issue from Intellij IDEA 2022.2, AS Chipmunk and Dolphin are known and fixes are underway. What I was wondering is why did it also break (in a different way) for Intellij 2021.3.1 and Bumblebee which were working perfectly fine with the old AGP versions. After looking
    idea.log
    this section seems to repeat itself for both Intellij IDEA 2021.3.1 and AS Bumblebee which shows some errors when syncing: https://pastebin.com/Q8qYJpgc. Is this related to the issue or is there something wrong with my config. One of those projects can be found here: https://github.com/Thinkrchive/Thinkrchive-Multiplatform. The branch
    working-kotlin-js-support
    is the one I'm currently working on and the one with all the issues. The 2nd project (larger one) is not open source unfortunately but has a very similar project structure and gradle configuration, but they both exhibit the same issues.
    e
    • 2
    • 12
  • k

    kyle

    07/08/2022, 7:07 PM
    Has anyone ever run into an issue when building an iOS project with a framework built from a multiplatform that fails with something like
    mylibrary.framework/Headers/mylibrary.h:488:16: imported declaration 'MylibraryKotlinStringCompanion' could not be mapped to 'KotlinString.Companion'
  • r

    Radoslaw Juszczyk

    07/08/2022, 7:54 PM
    hello, it might be trivial but... how to format a double to two decimal points like 1.123456 -> "1.12" so the decimal point is marked with
    .
    with pure kotlin? I can see that
    .format
    in kotlin stdlib uses java
    java.lang.String.format
    so it depends on the current locale whether it is
    .
    or
    ,
    I want to be able to enforce it to use
    .
    .
    e
    l
    • 3
    • 7
  • t

    Travis Reitter

    07/08/2022, 10:00 PM
    does anyone know what this message means? I can't tell how to deal with it. I'm hitting this in AppCode but I'm not sure if it's specific to that IDE
    Module 'android' uses an old-style KMM project configuration and cannot be updated automatically. Consider replacing the Kotlin Android plugin with Kotlin Multiplatform manually.
  • j

    Jeff Lockhart

    07/09/2022, 1:19 AM
    I created an androidCommonTest source set to share code between androidTest unit and androidAndroidTest instrumented tests. The change works as expected if I run the tests in the terminal, but it breaks the gradle sync in Android Studio, which fails with the error:
    Key androidCommonTest is missing in the map.
    There's no stack trace or further error info, unfortunately. In fact, the top-level build log completes with
    BUILD SUCCESSFUL
    . So it's unclear how to troubleshoot this. This is the build.gradle.kts change I made:
    kotlin {
      ...
      sourceSets {
        ...
        val commonTest by getting {
          ...
        }
        val androidCommonTest by creating {
          dependsOn(commonTest)
        }
        val androidTest by getting {
          dependsOn(androidCommonTest)
          ...
        }
        val androidAndroidTest by getting {
          dependsOn(androidCommonTest)
          ...
        }
      }
    }
    r
    • 2
    • 3
  • c

    Ciox

    07/09/2022, 12:36 PM
    Hello guys What do you use for dependency injection for Multiplatform mobile?
    m
    l
    +4
    • 7
    • 9
  • b

    Britto Thomas

    07/09/2022, 2:03 PM
    Is MVVM the best option as design pattern in KMM? Is there any other best/commonly used or native way?
    a
    l
    • 3
    • 4
  • j

    Jeff Lockhart

    07/09/2022, 3:19 PM
    How do you test async callbacks in commonTest (to run on Android and iOS)? Android tests run on TestRunner's pseudo main thread, allowing callbacks to call the real main thread in parallel. But iOS runs tests on the actual main thread, causing callbacks to deadlock while test code waits on the same thread. Is there a way to either change this behavior of which thread iOS tests are run on, or write tests in a way that works on both platforms?
    • 1
    • 1
  • b

    Britto Thomas

    07/09/2022, 3:56 PM
    How to create a new KMM project with iosApp in Storybord + UIKit Currently the default iosApp created with template is one with SwiftUI. And I am not seeing any option to switch SwiftUI to UIKit Storyboard while creating a KMM project using Android Studio
    j
    l
    • 3
    • 2
  • j

    Javier

    07/10/2022, 10:08 PM
    Is it planned to allow modifying the constantly JS library versions with vulnerabilities (🙃) in a better way than in the Gradle DSL? Maybe on the same yarn or in another different yarn file? Or on a file which can be compatible with Renovate/Dependabot. This one should be great because the web world is awful in terms of vulnerabilities and updating the JS libraries manually is… 😕
    ➕ 1
    h
    • 2
    • 2
  • c

    corneil

    07/10/2022, 10:14 PM
    Look into usong TOML catalogues for your versions. I'm sure dependabot will be processing the catalogues soon
    e
    j
    • 3
    • 2
  • s

    Sanjeev Kumar Sharma

    07/11/2022, 6:57 AM
    Why we need to comment out this line iosSimulatorArm64() to run PyTorch lite library
    d
    • 2
    • 2
  • a

    akapanina

    07/11/2022, 10:24 AM
    Hi folks! I’m Anastasiia, Product Manager for Kotlin Multiplatform, and I’m looking for Multiplatform newcomers to participate in a study! TL;DR: If you’re interested in Kotlin Multiplatform Mobile but have not had a chance to try it yet, you can get started by participating in the onboarding research our team is conducting – and get a reward :kotlin-intensifies-purple: We really want to know how developers interact with Kotlin Multiplatform Mobile from their first moments with it to the completion of their first cross-platform applications. If you have Kotlin and/or Android experience, have wanted to try Kotlin Multiplatform Mobile for a long time but haven’t had the chance, and are ready to get started with it under our supervision while sharing your feedback, then you’re just the hero we’re looking for! Your goal will be to write a simple KMM app, describe your experience in a diary, and have a couple of calls with us to discuss it all in person. Our goal is to tune our onboarding according to your feedback 🙂 The process will take about 3–4 hours a week for 3 weeks, and at the end, a reward and our infinite gratitude will be yours. If you’re interested, send me a DM. We’ll chat and set up an introductory call where I can tell you more about the study.
    👍 3
    m
    • 2
    • 1
  • j

    Jonathan Ellis

    07/11/2022, 8:47 PM
    I'm using a 3rd party library ("kbox2d") that I published to maven local. Trying to build my project that has kbox2d as a dependency, I get
    > Task :compileCommonMainKotlinMetadata FAILED
    e: java.lang.IllegalStateException: e: Could not find "C:\Users\Jonathan Ellis\Documents\essaie1-js\build\kotlinSourceSetMetadata\commonMain\com.soywiz.korlibs.kbox2d-kbox2d\com.soywiz.korlibs.kbox2d-kbox2d-commonMain.klib" in [C:\Users\Jonathan Ellis\AppData\Local\kotlin\daemon]
    This looks very much like https://youtrack.jetbrains.com/issue/KTIJ-18321, except I get this with gradle commandline as well as in intellij. I verified that the file it's looking for is in fact in the first directory mentioned. Is there a workaround to stop it from looking in AppData\Local\kotlin\daemon ? ETA: I can use the library fine for the JVM-only components, it's when I add it to commonMain that it causes problems.
  • e

    eygraber

    07/12/2022, 3:56 PM
    Anyone using AS Electric Eel and running into issues with running JVM apps that depend on a KMP library - https://issuetracker.google.com/issues/238642989
  • s

    Slackbot

    07/12/2022, 5:38 PM
    This message was deleted.
  • t

    Trey

    07/12/2022, 6:09 PM
    I'm trying to understand C interop for some iOS native code I'm writing. Is it possible to convert ${type}Var to ${type}? I have a CValuesRef<${type}Var> and I need to access the $Type. So I need to grab the ${type}Var from within the CValuesRef and then convert that to ${type}.
    • 1
    • 1
  • a

    Alex Acosta

    07/12/2022, 7:39 PM
    Hi all, I am getting
    Expected class 'Platform' has no actual declaration in module [my module] for JVM
    in the sample app, I assume this is an IDE issue since gradle commands are working fine. I just want to know which Android Studio version I should use for the following settings: Kotin: 1.7.10 AGP: 7.2.1 Gradle distribution: 7.3.3 Gradle JDK: 11 Android Studio: Dolphin | 2021.3.1 Beta 5 (#AI-213.7172.25.2113.8774922)
    j
    • 2
    • 6
  • t

    Trey

    07/12/2022, 9:50 PM
    Is it possible to cast a NativePtr to CValuesRef<*>? I have an existing object that I can call objcPtr() on to get a NativePtr, but I'm not sure how to cast it.
  • s

    Sean Proctor

    07/13/2022, 12:49 AM
    For a KMP project that just targets android and jvm, is it possible to get Android Studio/IntelliJ to not mark Java-specific stuff as an error?
    x
    e
    • 3
    • 8
  • d

    Devendra Kumar Gaur

    07/13/2022, 6:35 AM
    @Deactivated User How to use bitmap in native IOs Application and change the CGimage in Korim Bitmap.
  • m

    Marco Righini

    07/13/2022, 8:41 AM
    Hello everybody, talking about KMM libraries and iOS. What’s in your opinion the feasibility and likelihood that apple will start detecting apps using KMM and rejecting them in the future?
    k
    s
    +2
    • 5
    • 9
  • g

    Gillian Buijs

    07/13/2022, 10:22 AM
    I updated my KMP project to use koktlin 1.7.10 and everything compiles and works fine. When I however use it as a dependency in another project I get a compiler error: "java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments.setUseK2(boolean)". The depending project uses the same kotlin version etc. Anyone encountered anything similar?
    a
    • 2
    • 29
  • r

    Robert Jaros

    07/13/2022, 11:43 AM
    I have a strange problem with importing a mpp project in IntelliJ (2022.1.3 Ultimate). More info in thread.
    • 1
    • 6
  • s

    Stylianos Gakis

    07/13/2022, 1:26 PM
    Not sure if right channel, but related to MP and the IDE. I really like when I got a file called Foo open from two different source-sets in the tab it is shown as “jvmMain/…/Foo.kt” and “commonMain/…/Foo.kt”. When I close one of the two source-sets it shows just “Foo.kt”. I personally would prefer that it’d show the sourcesSet/…/ prefix at all times, even if I only got one of them open, instead of me having to look at the breadcrumbs or somewhere else to figure out where I am. If this is not something that is currently available, I will make a feature request, but asking here first to see if someone else has thought of it or if this setting exists already and I haven’t found it.
    🙏 1
    ➕ 1
    l
    m
    • 3
    • 5
  • d

    darkmoon_uk

    07/13/2022, 2:03 PM
    "Kotlin not configured" ...I've applied the
    multiplatform
    plugin and even depended on the
    stdlib
    in
    commonMain
    - what else is there to convince the IDE it's configured?
    l
    m
    m
    • 4
    • 12
  • j

    Javier

    07/13/2022, 6:38 PM
    I am creating a lib which just helps to ignore tests based on the platform. Problem is expect/actual are failing when I enable JS, as you can see, multiple source sets are being created in the
    build/externals/*
    and added, so I am getting multiple redeclarations, any way to fix it?
    • 1
    • 1
  • e

    eygraber

    07/13/2022, 7:28 PM
    Why do enums turn into
    KotlinEnum
    in swift? Why not a native enum?
    m
    m
    +5
    • 8
    • 22
  • t

    Trey

    07/13/2022, 9:04 PM
    Are there any examples of how to use GCD from iOS via Kotlin? I'm trying to work out a few issues and that would be helpful.
    m
    • 2
    • 10
Powered by Linen
Title
t

Trey

07/13/2022, 9:04 PM
Are there any examples of how to use GCD from iOS via Kotlin? I'm trying to work out a few issues and that would be helpful.
m

mbonnin

07/13/2022, 9:08 PM
We're using it here: https://github.com/apollographql/apollo-kotlin/blob/f38bbedee78c2fabc9cdae0d680036a24f7048ff/apollo-runtime/src/appleMain/kotlin/com/apollographql/apollo3/internal/dispatchers.kt#L48
t

Trey

07/13/2022, 9:16 PM
Thanks, that's helpful. I'm trying to create a serial queue and I'm trying to work out how to access DISPATCH_QUEUE_SERIAL. I didn't see any place that your code does that. Did I miss it? Looks like it just uses system queues.
m

mbonnin

07/13/2022, 10:00 PM
Looks like
DISPATCH_QUEUE_SERIAL
is just null: https://opensource.apple.com/source/libdispatch/libdispatch-685/dispatch/queue.h.auto.html
So you might make it work by passing just "null"
dispatch_queue_create("myqueue", null)
That doesn't solve the more general issue though 😅
I would try something in the likes of this in the general case:
dispatch_queue_create("myqueue", DISPATCH_QUEUE_SERIAL!!.reinterpret<dispatch_queue_attr_tVar>().pointed.value)
Well, actually more like
dispatch_queue_create("myqueue", DISPATCH_QUEUE_SERIAL?.reinterpret<dispatch_queue_attr_tVar>()?.pointed?.value)
(but I haven't tested any of this)
t

Trey

07/14/2022, 2:28 PM
Thanks for the advice. I'll give that a try.
👍 1
View count: 14