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

    Justin Brooks

    11/23/2022, 3:57 PM
    Hi All, I noticed in the docs that pure swift dependencies aren't supported.
    Pure Swift modules are not yet supported.
    I reached for SwiftSoup for a particular requirement I'm working on, but it was unusable for this reason. However, I noticed the yet in there. I searched the kotlin issue tracker for an issue I could follow for updates and didn't find one. Is this an eventual goal of the KMM and/or Kotlin/Native toolchains? Did I miss an issue? This seems like something that would benefit KMM use-cases a lot, but I'd be interested in reading about technical difficulties or progress.
    a
    • 2
    • 2
  • t

    Tomas Kubernat

    11/24/2022, 1:40 PM
    Hi guys, i’m not sure if this is correct channel. Sorry if not. I have one Android Kotlin library using
    Ktor
    and another Java Android project(library + UI application) using mentioned Kotlin library and its api. Unfortunately i can’t compile the UI application using both mentioned libraries with following message from gradle:
    However we cannot choose between the following variants of io.github.pdvrieze.xmlutil:serialization:0.84.0:
              - androidRuntimeElements-published
              - jvmRuntimeElements-published
            All of them match the consumer attributes:
    Have you ever had similar problem? I can’t find any way how to solve this.
  • a

    An Tran

    11/24/2022, 2:10 PM
    Hello, any example for using ViewModel in the shared layer which has state flow?
    j
    a
    +2
    • 5
    • 8
  • s

    Sean Keane

    11/24/2022, 6:17 PM
    Hi guys, I have a question around a Multiplatform SDK. I'm wondering if it's possible to build UI Components in the Android Portion of the SDK only to be consumed within a regular android app? (Jetpack Compose preferred, but open to Jetbrains Compose)
    j
    • 2
    • 2
  • d

    Don.Robertson

    11/24/2022, 7:58 PM
    I'm trying to build a Multiplatform library for Android and iOS. I'm very inexperienced with gradle and KMP. Does anyone have links to simple gradle files for this configuration? My app that would consume this uses the standard KMP template in Android Studio (with source sets for androidMain, iosMain, commonMain etc). Particularly useful would be stuff for publishing appropriately to mavenLocal
    s
    • 2
    • 2
  • c

    Crul

    11/25/2022, 3:27 AM
    Hello team, I’m pretty much new in KMM and need some guidance 🙂 Currently I have an Android app where it triggers the
    WorkerManager
    periodically every 30 minutes in the background to execute some tasks. One of the task is downloading the image from remote server and then store the image file in the local storage. My Questions are 1. How to implement the
    WorkerManager
    that will be triggered every 30 minutes in KMM ? (of course I hope it runs on Android and IOS) 2. How to store the image file in the local storage ? To make things even more confusing to me, currently in Android we have that thing called
    Scoped Storage
    . I’m not sure if IOS has this kind of concept as well. How to get around with this problem ?
    m
    k
    d
    • 4
    • 6
  • z

    zfan93

    11/25/2022, 6:31 AM
    I am writing an introduction document about KMM,who knows When was KMM proposed?thanks😀
    r
    • 2
    • 3
  • a

    ayodele

    11/25/2022, 2:07 PM
    Hello. How can I build my
    shared
    changes for Xcode? What I do right now run the iosApp to reflect changes in xcode (which I don't like)
    a
    c
    • 3
    • 4
  • j

    Josh Eldridge

    11/25/2022, 7:18 PM
    Hey all, I'm sure I may be missing something specific to my gradle setup, but has anyone encountered an error of
    Could not find :kotlin-native-prebuilt-macos-x86_64:1.7.21.
    when trying to compile a shared module for kotlin multiplatform mobile? I know it's part of the 1.7.21 release (because I see it here https://github.com/JetBrains/kotlin/releases) but gradle isn't finding it, maybe my repositories aren't setup right?
    a
    a
    • 3
    • 5
  • a

    Android75

    11/26/2022, 10:22 AM
    Hi i am new in KMM and i ' am starting to use and study so... I have a first question. Can I use Kotlin Flow in KMM I' d like create an app crossplatfom and i want use Kotlin Flow.
    j
    • 2
    • 1
  • a

    André Thiele

    11/26/2022, 12:42 PM
    Hey everyone, I am currently facing a problem with Gradle syncs in a KMM project. Every time I have to sync, it downloads all the pods again. I have not changed the default config created by the KMM AS plugin.
  • a

    Achinth Gurkhi

    11/26/2022, 1:28 PM
    Hi, Our team is interested in building our Android and iOS apps using KMM. Looking for guidance from an SME in KMM. Can someone please let me know whom I should speak to?
    r
    • 2
    • 6
  • s

    Shabinder Singh

    11/26/2022, 10:12 PM
    I am using a jvmMain sourceset to share code across Desktop and Android*.* • IDE is recognising it ✅. • Apps Builds Fine ✅. Facing a Runtime Crash : NoClassDefFound ❌ . Any help is appreciated.
  • b

    benkuly

    11/27/2022, 10:53 AM
    Did you ever wonder, how to call Rust code from Kotlin Multiplatform? I've build Kotlin Multiplatform bindings for uniffi if you are interested. Currently only JVM and Native are supported as targets, but I'm working on JS support too.
    s
    k
    t
    • 4
    • 10
  • j

    Johann Pardanaud

    11/27/2022, 4:28 PM
    I have the following data class in my common code:
    data class SomeModel(val createdAt: Instant)
    In JS and Darwin targets, do you any recommandation to provide native dates for the
    createdAt
    property? Details in thread ➡️ 🧵
    s
    • 2
    • 9
  • p

    Piotr Krzemiński

    11/28/2022, 9:05 AM
    I’m getting
    Entry rest/lib/model-jvm.jar is a duplicate but no duplicate handling strategy has been set. Please refer to <https://docs.gradle.org/7.5.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy> for details.
    It’s because I have two Gradle modules that are called
    model
    , see a related thread for Kotlin/JS. Now there’s the clash also for JVM modules, but I cannot see an equivalent of
    moduleName
    for
    kotlin { jvm { … } }
    . Please advise!
    • 1
    • 2
  • p

    Piotr Krzemiński

    11/28/2022, 9:06 AM
    just stumbled upon it as well, asking again: https://kotlinlang.slack.com/archives/C3PQML5NU/p1669626349157219
  • a

    Antonin Porta

    11/28/2022, 9:28 AM
    Hi everyone, sorry if the question has already been answered but I can't seem to get Room working as an Android dependency in my kmm library. I've added the below implementation :
    val androidMain by getting {
        dependencies {
                    implementation("androidx.room:room-runtime:$roomVersion")
                    implementation("androidx.room:room-ktx:$roomVersion")
                    implementation("androidx.room:room-common:$roomVersion")
    //                kapt("androidx.room:room-compiler:$roomVersion")
    ...
    And also under the plugins block
    plugins {
      id("kotlin-kapt")
    }
    But I'm getting the error : "cannot find implementation for XDatabase" when the app is running. I have no issues compiling. I don't really understand what is missing or misconfigured. Any help would be great thanks 🙂 PS : I'm migrating an android library to kmm and haven't moved every dependency to kmm ones like SQLDelight...
    j
    • 2
    • 1
  • a

    Achinth Gurkhi

    11/28/2022, 11:55 AM
    Hi, I am new to KMM. Looking for in-depth tutorials on the beta version.
  • m

    Michael Paus

    11/28/2022, 5:54 PM
    I am trying to use an external shared library for some platform of a multiplatform project. This works perfectly but IntelliJ is just not able to resolve the generated code. More details inside the thread.
    p
    l
    • 3
    • 14
  • m

    Meherdatta Chepuri

    11/28/2022, 9:13 PM
    What is a good Crash reporting system to use for a KMM application?
    l
    • 2
    • 2
  • e

    eygraber

    11/29/2022, 12:58 AM
    Is there no
    until
    function for
    Float
    in common code?
    e
    m
    • 3
    • 7
  • h

    Hee Fan

    11/29/2022, 2:06 AM
    Hi guys, I have a question on the sample SpaceXNews App that KMM doc provides. The tutorial link is here Create a multiplatform app using Ktor and SQLDelight, source code is on github, I got a crash on iOS App when I try to test on SwiftUI. The crash happens on
    RocketLaunchRow_Previews
    when I try to make a
    mockRocketLaunch
    . It seems the
    mockRocketLaunch
    can not be initialised. From the crash log, I think it might be native memory model issue, however, I could not get useful information to find out the root cause. Could anyone provide more information on the crash? Thanks.
    // Crash Log 
    1   libsystem_pthread.dylib       	       0x1af25a1e8 pthread_kill + 256
    2   libsystem_c.dylib             	       0x180129e28 abort + 124
    3   shared                        	       0x106ad9924 konan::abort() + 12
    4   shared                        	       0x106ae791c (anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const + 20
    5   shared                        	       0x106ae77e0 void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1) + 80
    6   shared                        	       0x106ae75a0 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*) + 56
    7   shared                        	       0x106ae7530 (anonymous namespace)::processUnhandledException(ObjHeader*) + 100
    8   shared                        	       0x106ae93d4 kotlin::ProcessUnhandledException(ObjHeader*) + 60
    9   shared                        	       0x106aeccb4 Kotlin_ObjCExport_trapOnUndeclaredException + 36
    10  shared                        	       0x106a96e9c objc2kotlin.1298 + 424 (/<compiler-generated>:1)
    11  RocketLaunchRow.1.preview-thunk.dylib	       0x114f2f268 @nonobjc SharedRocketLaunch.init(flightNumber:missionName:launchDateUTC:details:launchSuccess:links:) + 220
    12  RocketLaunchRow.1.preview-thunk.dylib	       0x114f2dd58 SharedRocketLaunch.__allocating_init(flightNumber:missionName:launchDateUTC:details:launchSuccess:links:) + 120
    13  RocketLaunchRow.1.preview-thunk.dylib	       0x114f2da74 static RocketLaunchRow_Previews.__preview__previews.getter + 940 (RocketLaunchRow.swift:53)
    14  iosApp                        	       0x1049817c8 protocol witness for static PreviewProvider.previews.getter in conformance RocketLaunchRow_Previews + 12
    15
    Source Code
    // iosApp/iosApp/RocketLaunchRow.swift
    import SwiftUI
    import shared
    
    struct RocketLaunchRow: View {
        var rocketLaunch: RocketLaunch
        
        var body: some View {
            HStack {
                VStack(alignment: .leading, spacing: 10.0) {
                    Text("hello world")
                }
                Spacer()
            }
        }
    }
    
    
    extension RocketLaunchRow {
        private var launchText: String {
            if let isSuccess = rocketLaunch.launchSuccess {
                return isSuccess.boolValue ? "Successful" : "Unsuccessful"
            } else {
                return "No data"
            }
        }
    
        private var launchColor: Color {
            if let isSuccess = rocketLaunch.launchSuccess {
                return isSuccess.boolValue ? Color.green : Color.red
            } else {
                return Color.gray
            }
        }
    }
    
    
    struct RocketLaunchRow_Previews: PreviewProvider {
        static var previews: some View {
            let links = Links(patch: nil, article: "article")
    
            let mockRocketLaunch = RocketLaunch(flightNumber: 1,
                                                missionName: "Mars",
                                                launchDateUTC: "UTC+8",
                                                details: "Details",
                                                launchSuccess: true,
                                                links: links)
    
    
    
        }
    }
    k
    • 2
    • 4
  • m

    Mychael Koelfat

    11/29/2022, 9:58 AM
    Hey everyone. I've gotten my Kotlin Multiplatform running on an iOS app. However, a couple seconds after running the app, it crashes, giving the error
    Function doesn't have or inherit @Throws annotation and thus exceptions isn't propagated from Kotlin to Objective-C/Swift as NSError.
    If I understand correctly, because Kotlin has no concept of checked exceptions, where Swift only has checked errors. Though I do not understand how I fix this, the documentation doesn't make that too clear for me. Does anyone know how to fix this?
    h
    k
    • 3
    • 3
  • r

    Raphael TEYSSANDIER

    11/29/2022, 1:21 PM
    Hello, how do I make a
    fatJar
    with kotlin multiplatform ?
    b
    • 2
    • 7
  • i

    Igor Milakovic

    11/29/2022, 6:42 PM
    Do we have anyone here successfully using Ktor 2.x on iOS 12? Looking at KTOR-4159, it appears to be fixed, but I don't think it is. Last activity was in early September suggesting to use
    io.ktor:ktor-client-darwin-legacy
    instead of
    io.ktor:ktor-client-ios
    , but after making that change I can't even build the app:
    ** ARCHIVE FAILED **
    The following build commands failed:
    PhaseScriptExecution [CP-User]\ Build\ shared ~/Library/Developer/Xcode/DerivedData/iosApp-dwshccrfrznbhwgdphnxyuqdispt/Build/Intermediates.noindex/ArchiveIntermediates/My\ App/IntermediateBuildFilesPath/Pods.build/Staging-iphoneos/shared.build/Script-80ED0967EE0BBCFEB52FF26F11A47A90.sh (in target 'shared' from project 'Pods')
    I'm using Kotlin 1.7.21 and Ktor 2.1.3. I've tried downgrading all the way to Kotlin 1.6.0 and Ktor 2.1.1 (the version in which it was supposedly fixed), but no luck. Thanks in advance!
  • k

    Kirill Zhukov

    11/29/2022, 7:35 PM
    When applying Kotlinx-Serialization and KMP-NativeCoroutines plugins in the same KMP module, getting this error during configuration:
    > Cannot add task 'commonizeNativeDistribution' as a task with that name already exists.
    Any ideas?
    r
    • 2
    • 20
  • r

    Raphael TEYSSANDIER

    11/29/2022, 8:03 PM
    Hello, I decompiled a java class inside my kmp jar. But I see some weird things
    public final Object connectLocal(@NotNull final Credential.LocalMode credential, @NotNull final List features, @NotNull final Function1 configuration, @NotNull Continuation $completion) {
          return FlowKt.callbackFlow((Function2)(new Function2((Continuation)null) {
        ...
    };
    The last argument isn’t used, but in
    callbackFlow
    we pass null instead of the completion. Any idea ?
    r
    • 2
    • 15
  • h

    Hasan Nagizade

    11/29/2022, 9:25 PM
    Where should I keep the viewModel? In common code or platform spesific?
    s
    k
    +2
    • 5
    • 8
  • j

    John Huang

    11/29/2022, 10:35 PM
    This has to be a simple question - How do I do numeric formatting (without scientific notation) in KMM? DecimalFormat is Java
    e
    • 2
    • 1
Powered by Linen
Title
j

John Huang

11/29/2022, 10:35 PM
This has to be a simple question - How do I do numeric formatting (without scientific notation) in KMM? DecimalFormat is Java
e

ephemient

11/29/2022, 10:46 PM
https://youtrack.jetbrains.com/issue/KT-21644
View count: 28