https://kotlinlang.org logo
Join Slack
Powered by
# multiplatform
  • n

    Nero Nguyễn

    07/01/2025, 6:18 PM
    Hi guys, Im looking for open-source KMP projects to learn and contribute, please ping me if you need a member
  • p

    Paulina Sobieszuk

    07/02/2025, 8:03 AM
    Hi everyone, Did you know that the Kotlin 2.2.0 release is out? The Kotlin Research team is looking for ways to improve the documentation of our new releases. Do you often read the documentation of new releases? If so, would you be interested in helping us out by giving your feedback on the latest one? We invite you to take part in an unmoderated task. This task requires recording your screen and voice, and will take approximately 10 minutes to complete. Everybody who completes the unmoderated task with meaningful answers will have the chance to win a prize of their choice: USD 50 Amazon Gift Card, or 6-month JetBrains All Products Pack subscription. ➡️ Click here to complete a short questionnaire. If your profile matches our study criteria, you will be redirected to take the unmoderated task on another website. Questions? We’d be more than happy to answer them. We look forward to receiving your responses!
    👀 1
  • e

    Excellence kawej

    07/02/2025, 11:33 AM
    Hello everyone, where can I find the library for previewing composable in compose Multiplatform???
    ➕ 1
    o
    • 2
    • 1
  • a

    Abhimanyu

    07/02/2025, 4:05 PM
    Hi all 👋 , What is the recommended way to handle runtime permissions in Compose Multiplatform projects? Any official solutions to handle this?
    🚫 1
    p
    • 2
    • 1
  • b

    Bitter

    07/02/2025, 4:55 PM
    Hello folks . I just upgraded to XCode Version 16.3 ,. I am using dynamic library option by marking the isStatic has false in my shared gradle file.
    Copy code
    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "shared"
            isStatic = false
        }
    }
    I get this strange "Cannot find Previews" error in my project as you can see in the screenshot. Anyone else ?
  • v

    Vivek Modi

    07/02/2025, 7:12 PM
    Hi everyone! I'm looking for a gRPC example that supports Kotlin Multiplatform, targeting Android, iOS, Desktop, and Web. Does anyone have a working example or repo they could share? Thanks in advance!
    t
    • 2
    • 2
  • e

    Excellence kawej

    07/03/2025, 11:56 AM
    Hi everyone, I'm facing this issue, but I've not found a good solution to that:
    Copy code
    /Users/ctrltech/StudioProjects/Tmaterials/shared/src/commonMain/kotlin/com/geekpastor/shared/ui/components/singleComponents/AppBar.kt:67:35 Unresolved reference 'painterResource'.
    As you can see, it's happening in commonMain module, and I've tried to find a multiplatform library for resources, but it seems to not be stable each time I have tried to install it, it causes other issues. Doo you have ay other solutions that you could suggest me???
    p
    a
    • 3
    • 13
  • r

    Rik van Velzen

    07/03/2025, 1:05 PM
    Hi all, I am working on a KMP project CMP 1.8.1 promised the bundling of the composeResources into the XCFramework. After assembling the debugXCFramework and trying to use it in a iOS sample in XCode the app crashes. Here a copy/paste of a post I put on YouTrack but maybe someone here knows faster?
    Copy code
    Somehow I still can't use the composeResources in ios.
    
    The project has multi-module set up with Kotlin 2.2, CMP 1.8.2 (& Skie 0.10.4), using an ios-umbrella.
    
    When I run ios-umbrella:assembleDebugXCFramework on Android Studio side and inspect the generated .xcframework I can see that XCFrameworks are created for 2 targets:
    
    ios-arm64
    ios-arm64_x86_64-simulator
    with one difference:
    
    The ios-arm64 target contains a /Relocations/aarch64 folder (within ./dSYMs/....frameworkdSYM/Contents/Resources) with a [MyProjectName].yml file in it.
    That yml file contains a list with an overview of drawable/font resources etc. and some addresses and size information.
    
    The simulator target doesn't have this(?)
    Since I am running my ios app via XCode in a simulator:
    
    Does this have anything to do with that I am running into exceptions like below?:
    
    Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: /Users/.../Library/Developer/CoreSimulator/Devices/A5C47791-3B4E-4A31-8DFC-7AED41EA2C83/data/Containers/Bundle/Application/47E8ED7F-1BAF-48E1-9E8A-E8EF14D38105/Sample.app/compose-resources/composeResources/....ui/font/pt-sans-regular.ttf
    👀 1
    t
    k
    t
    • 4
    • 4
  • r

    RadimJanda

    07/03/2025, 2:41 PM
    Hi all. I was wondering what are your usual build times for KMP projects? We have around 270 shared modules for SwiftUi app and the release build time currently takes around 2 hours. (debug build is much faster, like 10-20min) We use cocoapods, the modules vary from little ones (with 2 classes to bigger ones 100+-classes). The step that takes almost all time is ./gradlew -p shared kmmsharedKmm:syncFramework -Pkotlin.native.cocoapods.platform=iphonesimulator -Pkotlin.native.cocoapods.archs=arm64 -Pkotlin.native.cocoapods.configuration=Release I wonder if such build times are normal, or if there is something we can do to speed it up.
    t
    • 2
    • 4
  • p

    Paolo Pasianot

    07/03/2025, 3:58 PM
    Hi everyone, I'm working on my KMP project and I've run into an issue with initializing classes via Koin when they have different constructor requirements based on the platform. For example, imagine I have a class that needs an Android Context in its constructor for the Android target, but obviously not for the iOS target. How can I inject the same object (defined by an interface) using Koin, while delegating the actual implementation and its specific constructor dependencies to each individual platform (Android and iOS)? Thanks
    o
    q
    v
    • 4
    • 5
  • k

    Kilian

    07/04/2025, 10:31 AM
    HI, I notice that when using compose multiplatform resources all resources are packed into the android assets folder. This result in play store not being able to split the density related resources like drawables and only download the necessary once for a specific android device. Is there any workaround for that, as this increases my android app by an substantial amount. I already opened a youtrack issue https://youtrack.jetbrains.com/issue/CMP-8509/Compose-Multiplatform-Resources-Density-Split-not-supported . Thanks
    👍 1
  • d

    Darryl Pierce

    07/04/2025, 12:25 PM
    Does anybody have an example for how to display an image asynchronously in SwiftUI? I've managed to find ways to load the data and to share the data from ByteArray to NSData, but I'm stumped with having SwiftUI make the call down to retrieve the data and then show it. If this off-topic, sorry in advance and please point me to the right channel to ask.
    b
    a
    • 3
    • 23
  • m

    Michael Paus

    07/04/2025, 3:57 PM
    I guess a few of you are using Coil to load and show images. Can anybody explain to me why I see a cross-fade animation of the images inside an AsyncImage only once for each image but not when I show the image for a second time? I have set up an AsyncImage like this:
    Copy code
    AsyncImage(
    	model = ImageRequest.Builder(LocalPlatformContext.current)
    		.data(resolvedTalkImageUrls[currentImageIndex])
    		.crossfade(true)
    		.build(),
    	...
    )
    I currently testing this on desktop but later it is supposed to run on wasmJs too.
    👍 1
    e
    • 2
    • 2
  • z

    zt

    07/05/2025, 12:02 AM
    I have several tests which generate output files and I'm wondering what others do for this. At the moment I have a util function in my common code that writes to
    ./build/test-output/$PLATFORM
    PLATFORM
    being an expect val which is set in each sourceset to the proper directory. Is there a better way to go about this maybe communicating with gradle somehow?
    a
    • 2
    • 1
  • p

    Pavlos

    07/05/2025, 11:08 AM
    Hello, has anyone tried successfully scheduling background work in iOS via Kotlin Multiplatform? I have been trying for days, the work gets scheduled (a
    BGAppRefreshTaskRequest
    and a
    BGProcessingTaskRequest
    ), triggering it via
    //e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"{my_work_name}"]
    works successfully. It just doesn't run by itself at all, I have the app running in 2 iPhones for 3+ days, with opening the app every day a lot of times, nothing. Also nothing significant is being logged at Console.app in my Mac, the work just never starts, there aren't any exceptions or crashes at all. Also every setting is enabled successfully at both phones. It just doesn't run. If the iOS enforces that "because of low usage", then how is a new installer of my app supposed to use this functionality at all? I would love your thoughts and if anyone has made it work: Code continues in the thread 🧵👇
    • 1
    • 3
  • h

    Hemanth

    07/05/2025, 11:59 AM
    Hi, is there any way to increase/disable the timeout for wasmJs tests?
    t
    • 2
    • 1
  • g

    Goutham Devaraju

    07/05/2025, 2:04 PM
    Hello Team, Kindly share your thoughts on below. We are planning to migrate our mobile app to Kotlin Multiplatform (KMP). Right now, all features are already built natively in Android (Kotlin) and iOS (Swift). These are the main features in the app: • Splash screen • Push notifications (Firebase) • Live location tracking • Socket integration for live location • Custom chat integration (using QuickBlox) • Audio/video calls and group chat (QuickBlox) • Custom map screens (clusters, custom markers, etc.) The idea is to use KMP to share as much business logic as possible, but keep the platform-specific parts like UI, SDK integrations (e.g. QuickBlox, Maps) native. Basically: • UI stays native (Compose/SwiftUI) • Push notifications, audio/video SDKs stay native • Maps UI stays native • Shared logic for things like sockets, data models, chat message handling, location data transformations goes into KMP I want to reduce duplicate code and maintenance costs between Android and iOS. Do you think KMP is a good fit for this project? Or would you suggest sticking with purely native code or using another cross-platform tech? Appreciate your thoughts!
    a
    c
    • 3
    • 2
  • r

    Rob

    07/05/2025, 4:30 PM
    Good morning! I've been trying to update my KMP project to Kotlin 2.2.0 but I have a build error on Android related to D8. I've tried updating my AGP to the latest (8.12.0-alpha08) and I still see this issue. I'm not sure what to try next. Thanks!
    t
    • 2
    • 5
  • b

    blakelee

    07/06/2025, 4:42 AM
    Has anyone managed to get working debug source sets besides androidDebug? There’s been a little bit of talk throughout the years but no complete working example
    t
    • 2
    • 5
  • k

    Kinar Sharma

    07/06/2025, 10:39 AM
    tried to make a simple screen with ViewModel targeting Android, IOS, Web, after adding ViewModel to my composable like below,
    Copy code
    viewModel: ScreenAViewModel = viewModel { ScreenAViewModel() }
    I ran the Web app and it's failing at compilation with the following errors
    Copy code
    e: user/Demo/composeApp/src/commonMain/kotlin/com/example/demo/screenA/ScreenA.kt:21:37 Unresolved reference 'compose'.
    e: user/Demo/composeApp/src/commonMain/kotlin/com/example/demo/screenA/ScreenA.kt:32:33 Cannot infer type for this parameter. Specify it explicitly.
    e: user/Demo/composeApp/src/commonMain/kotlin/com/example/demo/screenA/ScreenA.kt:32:33 Parameter 'viewModel' is uninitialized here.
    e: user/Demo/composeApp/src/commonMain/kotlin/com/example/demo/screenA/ScreenA.kt:32:33 Unresolved reference. None of the following candidates is applicable because of a receiver type mismatch:
    fun <T, R> DeepRecursiveFunction<T, R>.invoke(value: T): R
    can please someone explain why is it failing?
    z
    • 2
    • 8
  • g

    Ghasem Shirdel

    07/06/2025, 5:16 PM
    Hello, I was checking the performance and memory leaks of the iOS app, and two things caught my attention. The first issue is a leak related to
    supportsMainMenu
    , which I naturally don’t use anywhere in the iOSApp code. Is this being used in the background by Compose? The second issue happens when the function
    stackTraceToString
    is called — a leak occurs. Libraries like Napier and other logging libraries use this function. Is this problem only present in debug mode? My Compose version is 1.8.1 and Kotlin version is 2.2.0.
    • 1
    • 1
  • j

    Jasmin

    07/07/2025, 8:21 AM
    Hello 👋 I’m building an KMP Lib. I have assets under
    commonMain/resources/files/frontend
    . How do I need to configure Gradle to bundle these assets in the XCFramework and access them via
    NSBundle
    ? I know it must be possible somehow, because of the composeResources, which are getting correctly included. Here is my current access code:
    val basePath = NSBundle.mainBundle.resourcePath + "/files/frontend/"
    Unfortunately, Moko resources isn't a fit for my use case since I also need to support the
    mingw
    target, which it currently doesn't support. Every help is appreciated 🙂
  • e

    Excellence kawej

    07/07/2025, 10:44 AM
    Hi everyone, I'm having this issue :
    Copy code
    Unresolved reference 'RemoveRedEye'.
    
    Icon(
        modifier = Modifier.fillMaxSize(),
        imageVector = Icons.Filled.RemoveRedEye,
        contentDescription = "Voir le produit",
        tint = Color.White
    )
    While others are well-imported, like this one:
    Copy code
    Icon(
        modifier = Modifier.fillMaxSize(),
        imageVector = Icons.Outlined.Delete,
        contentDescription = "Supprimer du panier",
        tint = Color.Red
    )
    c
    e
    • 3
    • 13
  • b

    bk9735732777

    07/07/2025, 10:50 AM
    Hi i neeed some help woth Coacoapods integration for my KMP proj i have added cocoapods plugins
    Copy code
    alias(libs.plugins.kotlinCocoapods)
    and this is how i configured it but i have this build error when i run it
    t
    a
    • 3
    • 11
  • b

    bk9735732777

    07/08/2025, 3:03 AM
    I am not able to use Data class in my swift file is it not supported os is there any special way
    d
    • 2
    • 5
  • c

    Cees Wiersma

    07/08/2025, 7:16 AM
    Migrating to the new Android-KMP plugin caused our previews in commonMain to be broken. I've come across an issue for this already on the issue tracker (https://issuetracker.google.com/issues/422373442), without a solution yet. But maybe anyone here does know a temporary workaround?
    t
    m
    e
    • 4
    • 9
  • p

    Pablo

    07/08/2025, 9:50 AM
    After upgrading Android Studio to last version, 2025.1.1, I'm getting this error in kotlin multiplatform plugin:
    incompatible : requires IDE build 243.* or earlier
    Has someone faced this issue and solved it? Can't find info in google.
  • n

    Nikhil Pratap Singh

    07/08/2025, 10:13 AM
    Getting this error while syncing gradle with compose 1.8.x. can anyone help?
    .konan/kotlin-native-prebuilt-macos-aarch64-2.2.0/tools/konan_lldb.py
    j
    • 2
    • 1
  • e

    Excellence kawej

    07/08/2025, 10:23 AM
    Hello everyone here, thks to you who help all UI issues that i had while migrating to kotlin multiplatform, now it's time to resolve issues related logic and network configuration, from retrofit to ktor...
  • m

    MarkRS

    07/08/2025, 11:00 AM
    I want to access KMP resources from a locale that may be different from the system default. There are resource function variants for both stringArray and string that include ResourceEnvironment as a parameter, which looks great, but there doesn't seem to be any way to create such an object since it's declared as internal. Is there a (KMP) way I can do this?