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

    Karen Frangulyan

    03/16/2022, 12:15 PM
    Hey guys, I'm having problems running KMM shared library iOS unit tests from Android Studio. I'm always getting:
    Execution failed for task ':shared:iosSimulatorArm64Test'.
    ...
    Caused by: java.util.NoSuchElementException: No value present
    and it says 'Test events were not received' in the UI. The same task
    ./gradlew :shared:iosSimulatorArm64Test
    runs without problems from terminal. Any ideas?
    k
    • 2
    • 1
  • f

    Francis Mariano

    03/16/2022, 1:32 PM
    Is it OK coding KMM with M1 mac???
    :yes: 13
    m
    s
    • 3
    • 2
  • s

    Stefan Oltmann

    03/16/2022, 5:07 PM
    I want to build only a release XCFramework, but not both. Gradle generates me a
    assembleXCFramework
    task. I see in the docs that there should be also
    assembleDebugXCFramework
    and
    assembleReleaseXCFramework
    tasks, but I don't see them... How can I only build the release version? I don't need debug.
    ✅ 1
    t
    • 2
    • 3
  • s

    Stefan Oltmann

    03/17/2022, 9:49 AM
    How to speed up the task
    compileKotlinMetadata
    ? I set
    org.gradle.parallel=true
    in settings and even call it with --parallel, but this tasks takes 3 minutes for me - even on a beefy
    M1 Pro
    (8 performance cores) it tooks as long as on an M1. So this tasks does not benefit from more cores... What can I do to cut down compiling time here?
    ✅ 1
    c
    g
    • 3
    • 11
  • m

    Martin Rajniak

    03/17/2022, 10:17 AM
    Do you know if it is possible to turn off signing in
    embedAndSignAppleFrameworkForXcode
    It seems that signing config needs to be defined in XCode project file for it to work, and we do not need it for iOS application - just for the shared framework. So I wondered whether it can be turned off.
    d
    • 2
    • 1
  • f

    Francis Mariano

    03/17/2022, 11:30 AM
    Hi folks. I have an old imac machine which the last macos supported is Catalina (10.15.7). With macos Catalina I can install XCODE 12.4 and older. KotlinNative 1.6.0 and newer require XCODE 12.5. So, I am unable to use Kotlin/Native in my iMac. Are there some workaround for that??? Can I compile Kotlin/Native 1.6.0+ for iOS using AppCode in macOS Catalina????
    m
    d
    • 3
    • 4
  • a

    ankushg

    03/17/2022, 7:03 PM
    Hey folks, does anyone know of a decent guide on how to write JVM-only Kotlin code in a way that eventually is conducive to porting into Multiplatform? I feel like there’s a few big-picture things like: • Use Kotlin stdlib instead of Java wherever possible (e.g. Collections), and • Use KMP-friendly libraries instead of JVM-only ones wherever possible (e.g.,
    kotlinx.serialization
    vs Jackson/Moshi,
    kotlinx.coroutines
    vs RxJava) But I also feel like there are some slightly more advanced topics like increasing modularization to isolate code that’s already platform agnostic (or close to it) into a separate Gradle module so you can start KMP-ifying it without doing something like fully migrating off of RxJava if you’re using it I feel like I have an intuitive sense for most of this, but am looking for something to send over to some coworkers who’re working on backend services where they eventually want some parts to be able to run client-side via KMP
    c
    y
    +5
    • 8
    • 11
  • d

    Daeyoung Kim

    03/18/2022, 1:16 PM
    Hello~ Everybody~ I am struggling with KMM. At a first entrance, I am stuck in abnormal behavior of Xcode SwiftUI Preview. It always says “Automatic preview updating paused” This happens when pod ‘GoogleWebRTC’ added to build.gradle.kts of shared module - KMM plugin - app template.
    ```...
    iosSimulatorArm64()
    cocoapods {
    summary = "Some description for the Shared Module"
    homepage = "Link to the Shared Module homepage"
    ios.deploymentTarget = "14.1"
    podfile = project.file("../iosApp/Podfile")
    framework {
    baseName = "shared"
    }
    pod("GoogleWebRTC", moduleName = "WebRTC")
    }
    sourceSets {```
    Anybody knows why this happens?
    m
    • 2
    • 1
  • g

    Grégory Lureau

    03/18/2022, 4:19 PM
    Hello ! I just realized that
    sealed class
    can actually be instantiated from ObjectiveC! In Kotlin I can't because the constructor is private, but it looks like it's actually exported as public for ObjectiveC (tested on Kotlin 1.6.0). Is there a reason for that or is it just a bug tracked somewhere ?
    ✅ 1
    • 1
    • 1
  • m

    Marko Novakovic

    03/18/2022, 7:28 PM
    iOS crash
    Uncaught Kotlin exception: kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
    Kotlin 1.6.10 and 0.11.3-new-mm https://github.com/rickclephas/KMP-NativeCoroutines (idk if this library has anything to do with it tho)
    r
    • 2
    • 12
  • c

    Conrad Kramer

    03/19/2022, 6:21 PM
    Is there a way to use different versions of Kotlin, depending on the target platform? I need to use Kotlin 1.6.20 for a macOS framework fix, but I need Kotlin 1.6.10 in order to use Jetpack Compose on Android
    b
    j
    • 3
    • 5
  • n

    nikhil kumar

    03/20/2022, 6:52 AM
    hello, Is there a way to convert object to bytearray using kotlinx.serialization? I am only able to find encodeToString and decodeToString functions.
    p
    e
    c
    • 4
    • 15
  • n

    nikhil kumar

    03/21/2022, 8:26 AM
    hi, is there an alternative of @synchronized in kmm?
    m
    k
    t
    • 4
    • 9
  • m

    Marko Novakovic

    03/21/2022, 6:04 PM
    can anyone help me with this?
    > Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED
    e: Module "io.ktor:ktor-network (io.ktor:ktor-network-iossimulatorarm64)" has a reference to symbol kotlinx.coroutines/SingleThreadDispatcher|null[0]. Neither the module itself nor its dependencies contain such declaration.
    
    This could happen if the required dependency is missing in the project. Or if there is a dependency of "io.ktor:ktor-network (io.ktor:ktor-network-iossimulatorarm64)" that has a different version in the project than the version that "io.ktor:ktor-network (io.ktor:ktor-network-iossimulatorarm64): 1.6.8" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.
    I just added dependencies for ktor as per instructions for ktor kmm
    h
    n
    • 3
    • 11
  • j

    Jose Garcia

    03/22/2022, 11:56 AM
    Hi, we are building a multiplatform SDK with React-Native as our UI layer. I copied the React Native project into my project root directory to keep it everything together. However, the navigation (Jumping to definitions) won't work inside my React Native bridge (kotlin code using my SDK jar) and it's becoming hard to develop the bridge using Android Studio. Any suggestions? Does it have to do with
    settings.gradle
    and my project structure?
    👀 1
    g
    • 2
    • 2
  • m

    Marc Reichelt

    03/22/2022, 1:05 PM
    Hi there! We’re using the
    XCFramework
    task in Gradle to create a framework containing all 3 archs (x86 sim, arm64 sim, arm64 device) using Kotlin 1.6.10. However, when we run
    ./gradlew :assembleReleaseXCFramework
    , it’s compiling the 3 archs sequentially rather than in parallel. Did anyone find a good way to speed this up by running these sequentially?
    h
    • 2
    • 5
  • b

    brabo-hi

    03/22/2022, 5:31 PM
    Hi all, can we use firebase analytic on a KMM project?
    m
    k
    • 3
    • 12
  • c

    Conrad Kramer

    03/23/2022, 5:04 PM
    Is there an easier way to conditionalize Kotlin code on iOS simulator versus device other than different source sets?
    p
    c
    • 3
    • 11
  • v

    Vivek Modi

    03/23/2022, 5:41 PM
    Hey everyone, I have pre existing Android application using
    OKHTTP
    client with some`interceptors` and
    authenticator
    and iOS application using
    alamofire
    with
    interceptors
    .Both projects are huge in size. Now I want to use KMM for new api client. So How can I use these 2 http client through Ktor. I don't want to write from scratch in KMM module. Any suggestion?
    y
    • 2
    • 4
  • i

    iamsteveholmes

    03/24/2022, 2:19 AM
    Hey folks! Curious if you are all experiencing incredibly slow tests. Mine take over 2 minutes to complete and most of that seems to be the build cycle. Has anyone figured out how to get tests running a bit quicker?
    m
    m
    m
    • 4
    • 4
  • d

    diego-gomez-olvera

    03/24/2022, 11:29 AM
    Hello everyone ! I am exploring the KMM
    XCFramework
    publication and found an interesting plugin. Something that I am missing is the iOS/Swift project definition of the dependency. Is anyone using it? https://github.com/prof18/kmp-fatframework-cocoa
    k
    m
    • 3
    • 5
  • c

    Casey Brooks

    03/24/2022, 6:25 PM
    Does anyone know of a KSP project that works similar to Retrofit? I’m thinking of something that uses similar annotations and generates the corresponding Ktor API calls for Android and iOS
    ➕ 1
    k
    r
    • 3
    • 9
  • c

    Casey Brooks

    03/25/2022, 5:02 PM
    Why do the KMM sample repos manually create the shared module’s iOS targets for each architecture, rather than using the common
    ios()
    target?
    k
    • 2
    • 4
  • m

    Matthias Geisler

    03/25/2022, 6:51 PM
    Hello lovely people I put a little thing together, which might be interesting for you. Any feedback is highly appreciated.
    ⭐ 1
    🎉 4
    👍 7
    i
    g
    r
    • 4
    • 8
  • b

    Barry Fawthrop

    03/26/2022, 3:36 PM
    Why is import androidx.compose.ui.res unresolved? what dependency(ies) are needed? I can’t get painterResource working
    c
    • 2
    • 1
  • n

    Nikky

    03/26/2022, 8:29 PM
    how do you catch a
    java.net.ConnectException
    in common code? i cannot define a
    expect class ConnectException: Exception
    because that extends
    kotlin.Exception
    and not the java exception type.. and without that i cannot catch it.. event
    catch)e: Throwable)
    in common code does not catch it
    b
    a
    • 3
    • 2
  • c

    Conrad Kramer

    03/27/2022, 10:38 PM
    What is the best way to report a compiler failure that would likely be a pain to isolate on its own? Is there a way to upload attachments to only the JetBrains team working on it? I am getting a failure when linking a framework for iOS in release mode, but not debug mode (seemingly in the optimization passes)
    e: java.lang.NullPointerException
    	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$DevirtualizationAnalysisImpl.calleeAt(DevirtualizationAnalysis.kt:263)
    	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$DevirtualizationAnalysisImpl.access$calleeAt(DevirtualizationAnalysis.kt:120)
    	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$DevirtualizationAnalysisImpl$ConstraintGraphBuilder.processVirtualCall(DevirtualizationAnalysis.kt:978)
    	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$DevirtualizationAnalysisImpl$ConstraintGraphBuilder.checkSupertypes(DevirtualizationAnalysis.kt:1004)
    	at org.jetbrains.kotlin.backend.konan.optimizations.DevirtualizationAnalysis$DevirtualizationAnalysisImpl$ConstraintGraphBuilder.checkSupertypes(DevirtualizationAnalysis.kt:1011)
    • 1
    • 2
  • a

    Alen Kirm

    03/28/2022, 7:52 AM
    Hi! We are using KMP-Native-Coroutines and we have some issues. As soon as we try to add some
    suspend
    method inside
    Interface
    file, and conform to that file on iOS side,
    KMP-Native-Coroutines
    generates 3 versions of that method. Our example: Kotlin Interface method:
    suspend fun refreshTokenIfNeeded(accessToken: String)
    Results into (see attachment below) on iOS and blocks us. Are there any known issues regarding
    suspend
    methods in signature? Did anybody else face this problem? None of the workarounds seems future proof and could bite back soon. On modules, where
    KMP-Native-Coroutines
    plugin is not injected, it works fine as expected. Update: Looks like marking method with
    @NativeCoroutinesIgnore
    is a working workaround. Is this something worth taking a look at? 🤔
    r
    • 2
    • 5
  • n

    Nacho Ruiz Martin

    03/28/2022, 10:25 AM
    Hey! 👋 Not sure if this is really a question for this channel. I’m planning the architecture of a new app that will be used on browser, iOS and Android and I’m going to use KMM to share as much as possible. This includes the ViewModel/Controller/Service layer. Lately we are getting used to see more and more the single data flow pattern for the view layer on frameworks for the three platforms. Let’s call the object holding the state
    Store
    for convenience. Normally on Android (I’m not sure on iOS) this `Store`’s lifecycle is bound to the lifecycle of the screen itself (or navigation subgraph) and there’s one store per feature. But on web (if I’m not mistaken) usually there’s a single
    Store
    and it’s bound to the lifecycle of the whole app. This makes for me sense because usually on web there are a lot of components seen at the same time on screen. My question is, if we’re sharing the
    Store
    logic between mobile and web, does it make sense to have a single
    Store
    or is it better to have multiple
    Stores
    , one per component? Also, does it make sense to bind that to the screen lifecycle on mobile or keep a single instance for the whole app lifecycle? I know this is completely subjective, I’m only asking for some advice here! And sorry if the terms are not accurate, I’m only experienced on Android and I don’t really know the best practices on web dev and iOS, just what I read online. Thanks!
    l
    c
    • 3
    • 7
  • f

    Francesco Bonnì

    03/28/2022, 2:57 PM
    Hi everyone, I added Arrow on KMP and used it only in the commonMain part of our project. When I use the generated framework/aar, I’m experiencing some NoClassDefFoundError in the android application (iOS run without any problem), if I add the dependency on android I solve the problem but asap will be rise another NoClassDefFoundError in a KMP file, did somebody have the same experience or know where I should check to solve the problem?
    • 1
    • 1
Powered by Linen
Title
f

Francesco Bonnì

03/28/2022, 2:57 PM
Hi everyone, I added Arrow on KMP and used it only in the commonMain part of our project. When I use the generated framework/aar, I’m experiencing some NoClassDefFoundError in the android application (iOS run without any problem), if I add the dependency on android I solve the problem but asap will be rise another NoClassDefFoundError in a KMP file, did somebody have the same experience or know where I should check to solve the problem?
Update: After a crazy day, I moved the project from the multiplatform .aar to the android library, like the one created from the KMM plugin. The error disappeared and arrow works smoothly.
View count: 11