https://kotlinlang.org logo
Join Slack
Powered by
# kotlin-native
  • w

    wwalkingg

    07/30/2025, 5:51 AM
    Hello, if I write screen recording code using Kotlin Native, how can I grant the program macOS recording permissions? I've tried adding IDEA, Gradle, and kexe to the authorization list, but none of them worked. The error message is "The user declined TCCs for application, window, display capture."
  • a

    altavir

    08/01/2025, 7:25 AM
    I am getting strange error on Kotlin 2.2.20 on Windows:
    .konan\dependencies\msys2-mingw-w64-x86_64-2\bin\ld.gold: error: cannot find -lunistring
    does anybody know how to fix it? For some reason it happens only on some projects.
    n
    • 2
    • 2
  • g

    Ghasem Shirdel

    08/04/2025, 6:31 AM
    https://youtrack.jetbrains.com/issue/CMP-8223/Kotlin-2.1.21.-After-the-app-is-launched-f[…]rowable.stackTraceToString-causes-the-CPU-to-spike-to-100 https://youtrack.jetbrains.com/issue/CMP-8523/IOS-memory-leak Any updates on this issue? Deploying to production without a proper stack trace makes debugging extremely difficult. Thread in Slack Conversation
  • v

    Vishal kumar singhvi

    08/05/2025, 8:37 AM
    Hi everyone, I'm currently working on implementing Picture-in-Picture (PiP) functionality for a video player in a Kotlin Multiplatform (KMP) project. Specifically, I'm looking to: • Enable PiP when the user presses the home button • Support automatic PiP activation • Maintain compatibility with iOS/Android through KMP If anyone has experience with this or can recommend any helpful articles, tutorials, or blog posts on implementing PiP in KMP, I would greatly appreciate your suggestions. for IOS I am looking android i have created Slack Conversation
  • d

    Didier Villevalois

    08/07/2025, 2:41 PM
    Hey! It seems that there is no
    kotlin-native-prebuilt-2.2.0-linux-aarch64.tar.gz
    on Maven Central... Is that expected? I encountered that while loading the MCP SDK to make some PRs. I run Fedora Linux (Asahi) on an M1 MBP. I will disable the native targets for now, but that's quite uncomfortable... 😭
    o
    • 2
    • 2
  • r

    Raed Ghazal

    08/08/2025, 1:17 PM
    Hey, is it fine to use kotlin 2.2.0 without updating gradle to 9.0.0? apparently bitrise doesn't support building projects with gradle 9 yet, and I tested without it and it works fine, but here its mentioned that minimum gradle is 9 for kotlin 2.2
    j
    • 2
    • 3
  • s

    Stefan Oltmann

    08/17/2025, 6:37 PM
    If you’re considering writing your first Kotlin library and thinking about making a logging library… just don’t. 😬 What the ecosystem really needs is a pure Kotlin SigV4 library (that also works for Kotlin/Native). We now have the kotlin-native-aws-lambda-runtime to write our AWS lambdas in Kotlin/Native, but to interact with DynamoDB we seem to need to use something called "_AWS Signature Version 4"_ which isn't available to Kotlin/Native as far as I can see.
    h
    c
    +4
    • 7
    • 84
  • a

    Adam S

    08/22/2025, 8:42 AM
    What does the
    -include-binary
    KN compiler arg actually do? Does it just tell the compiler to package the files into the
    my-lib.klib
    in the
    /my-lib/default/targets/${targetName}/included/
    dir? Context: I have two
    .a
    static library files ( 'debug' and 'release'). I can't see how my subproject
    my-app
    can only use the debug
    my-lib
    when running
    runMyAppDebugExecutableMacosArm64
    and the release
    my-lib
    when running
    runMyAppReleaseExecutableMacosArm64
    . I was thinking about making two variants of my library, one that produces a
    my-lib-release.klib
    and another that produces
    my-lib-debug.klib
    . The only difference being the included static libs. If I can build the
    .klib
    manually, and just update the included files, that'd be a solution (albeit complicated and something I'd prefer to avoid).
    e
    • 2
    • 3
  • l

    loke

    08/25/2025, 5:30 AM
    I have a multiplatform project where the JVM implementation embeds some datafiles (JSON files, in this particular case) as resources which I load using the classloader. I need to do the same in the native backend, but I can't find a good way to do it. Ideally, I'd want to just link it as an ELF object, but that doesn't actually seem possible. Is there some nice gradle way I can transform the content to a string that becomes accessible as a variable during runtime? Or is there some other solution? What I really don't want to do is to convert the (rather large, some 10's of MB) text file into a string and saving it as a
    .kt
    source file.
    a
    • 2
    • 5
  • t

    tylerwilson

    09/12/2025, 3:27 AM
    What is the current best practice for Kotlin 2.2 and iOS GC. I have these in my gradle.properties. Do we think any or all of these are still needed, or would actually makes things worse?
    Copy code
    kotlin.native.binary.objcDisposeOnMain = false
    kotlin.native.binary.mimallocUseCompaction = true
    kotlin.native.toolchain.enabled = false
    kotlin.incremental.native = true
    👀 1
  • i

    Ian Botsford

    09/15/2025, 4:03 PM
    I'm confused about how Platform Library implementations are linked by the compiler. kodee lost From the docs: > The packages from platform libraries are available by default. You don't need to specify additional link options to use them. The Kotlin/Native compiler automatically detects which platform libraries are accessed and links the necessary ones. That doesn't match my experience on Windows using platform.windows. When I import and use the bindings for some Win32 APIs, I get link errors when building my test binaries:
    ld.lld: error: undefined symbol: <name of symbol>
    . The problem goes away if I specify
    -lversion
    as a linker argument. The specific APIs are GetFileVersionInfoSizeW, GetFileVersionInfoW, and VerQueryValueW, all of which are declared in *winver.h*, which is included in *windows.h*, which is specified as one of the headers bound in the *platform.windows* DEF file. Why aren't the platform library implementations properly automatically linked by the compiler?
    p
    • 2
    • 6
  • s

    Sergey Chelombitko

    09/15/2025, 8:35 PM
    Hey! Is there a way to prepend an include path before the sysroot path?
    Copy code
    kotlin {
        androidNativeArm64 {
            compilations.named("main") {
                cinterops.register("main") {
                    compilerOpts("-ID:/Apps/VulkanSDK/Include")
                }
            }
        }
    }
    I want to use the latest version of Vulkan headers from Vulkan SDK, but the headers from the sysroot path always get the priority:
    Copy code
    // This includes Vulkan 1.0 header from $HOME\.konan\dependencies\target-toolchain-2-windows-android_ndk/sysroot/usr/include\vulkan/vulkan.h
    #include <vulkan/vulkan.h>
    m
    • 2
    • 2
  • p

    Piotr Krzemiński

    09/20/2025, 7:29 AM
    I'd like to revive the efforts of compiling Kotlin to Python, but using a different approach than before (which was working on a fork of Kotlin monorepo). Instead, I'd like to work on klib - parse the IR stored there, and produce Python from it. This way I need to create a separate building block with well-defined API instead of fighting with the whole monorepo which is hard to work with. Does this idea make sense to you? For it to succeed, I need a library that can parse serialized IR from within the klib files - is there a library like this published somewhere? I don't mind unstable API, I just want to experiment 😁
    a
    y
    • 3
    • 4
  • u

    ursus

    09/20/2025, 12:53 PM
    If my ios project already uses SPM modules, and I want the SPM modules to depend on KMP code - is
    xcframework
    my only option?
  • u

    陈雄

    09/22/2025, 12:30 PM
    Does anyone know how to set "-fsanitize-coverage=func,trace-pc-guard" in build.gradle.kts for Kotlin/Native on iOS? Or how to configure the sanitizer?
  • o

    Omico

    09/24/2025, 3:09 AM
    Anyone can explain what does this commit do? And why? I’m unable to view KT-68583. https://github.com/JetBrains/kotlin/commit/1c025985ee822504b1891e5e18b5ad222b54e218
    g
    • 2
    • 4
  • h

    Huan

    10/06/2025, 2:14 PM
    hello, I am trying to reproduce a video using media3. The cell is inside a lazy column. I need that video continue playing when user scrolls and the cell is hidden. Currently i got that the video restarts, ¿Is possible that the video continue playing even if the composable is not visible and when it becomes visible just shows the current time where it was?
    c
    • 2
    • 2
  • l

    loke

    10/18/2025, 12:59 PM
    I note that
    memScoped
    uses
    nativeHeap
    , which eventually calls
    malloc
    for every allocation. I have a highly performance-intensive function where I need to allocate memory on the stack. Is there a way to get stack allocation instead?
    e
    a
    • 3
    • 3
  • l

    loke

    10/18/2025, 5:21 PM
    Is there a way to declare a function in Kotlin code which can be called from an inline C function in the cinterop definition file? I tried declaring it using
    @CName
    but when I link the code, I still get a symbol not found error.
  • v

    Vitaliy Zarubin

    10/24/2025, 8:49 AM
    Hello. Prompt why so can happen. Trying to compile a static library on macOS and Linux. The library that is compiled on Linux - works fine, but the library that is compiled on macOS does not work in Qt:
    Copy code
    undefined reference to `ac_path_info_get_app_cache'
    Here is the result of outputting nm on Linux:
    Copy code
    nm libdemo_kmp.a | grep ac_path_info_get_app_cache
    00000000000000 T ac_path_info_get_app_cache 
    U ac_path_info_get_app_cache
    
    nm -A libdemo_kmp.a | grep ac_path_info_get_app_cache
    libdemo_kmp.a:ac_path_info.ac_path_info.bb51b92a2c3716b4-cgu.0.rcgu.o:00000000000000 T ac_path_info_get_app_cache
    libdemo_kmp.a:libdemo_kmp.a.o: U ac_path_info_get_app_cache
    Here is the output of nm on macOS:
    Copy code
    nm libdemo_kmp.a | grep ac_path_info_get_app_cache 
    U ac_path_info_get_app_cache
    
    nm -A libdemo_kmp.a | grep ac_path_info_get_app_cache
    libdemo_kmp.a:/private/var/folders/v1/0hmt9k0s2rj_wfvb9kkm43rw0000gn/T/konan_temp8842548127760527663/libdemo_kmp.a.oac_path_info_get_app_cache
  • t

    tylerwilson

    10/28/2025, 3:39 AM
    With the latest Kotlin 2.2.21 I am getting an error when running gradle task 'commonizeCInterop'. It shows a weird call stack like so:
    Copy code
    Exception in thread "main" org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.
    	at org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:99)
    	at org.jetbrains.kotlin.protobuf.CodedInputStream.skipField(CodedInputStream.java:262)
    	at org.jetbrains.kotlin.protobuf.GeneratedMessageLite.parseUnknownField(GeneratedMessageLite.java:540)
    	at org.jetbrains.kotlin.protobuf.GeneratedMessageLite.access$100(GeneratedMessageLite.java:49)
    	at org.jetbrains.kotlin.protobuf.GeneratedMessageLite$ExtendableMessage.parseUnknownField(GeneratedMessageLite.java:246)
    	at org.jetbrains.kotlin.metadata.ProtoBuf$PackageFragment.<init>(ProtoBuf.java:28327)
    	at org.jetbrains.kotlin.metadata.ProtoBuf$PackageFragment.<init>(ProtoBuf.java:28285)
    	at org.jetbrains.kotlin.metadata.ProtoBuf$PackageFragment$1.parsePartialFrom(ProtoBuf.java:28407)
    If I put it back to Kotlin 2.2.20, it works fine. Known issue? I will check the release notes again, perhaps I missed something there.
    • 1
    • 1
  • s

    spierce7

    11/02/2025, 9:32 PM
    It's been a few years since I was following Kotlin native super closely. I'm curious if the native performance has gotten much better.
    s
    l
    • 3
    • 6
  • s

    Sergey Chelombitko

    11/02/2025, 11:16 PM
    Has anyone found a way to set Android API level for Android native targets? struggling to find how to switch from the default
    ~/.konan/dependencies/target-toolchain-2-osx-android_ndk/bin/aarch64-linux-android21-clang
    to
    ~/.konan/dependencies/target-toolchain-2-osx-android_ndk/bin/aarch64-linux-android29-clang
    e
    • 2
    • 1
  • s

    sergey.bogolepov

    11/05/2025, 10:34 AM
    Hey folks! In 2.3.0-Beta2 we tuned a few things here and there to improve release build times. The difference should be especially noticeable in larger projects. It would be awesome if you could give it a try and share your results in this thread! 🙏
    kodee happy 4
    👀 4
    🙌 10
    👏 4
    🙌🏾 2
    👏🏾 2
    l
    • 2
    • 3
  • l

    loke

    11/10/2025, 3:38 PM
    After upgrading to Java 25, I'm getting this error when compiling my native code:
    Copy code
    > Task :array:cinteropLibcurlLinux
    WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
    Is this a known issue, and is there anything I should do to fix it?
    c
    • 2
    • 3
  • u

    אליהו הדס

    11/11/2025, 6:35 PM
    Is it planned to be possible to use Flatbuffer with Kotlin Native?
    d
    • 2
    • 1
  • j

    Julius Babies

    11/15/2025, 11:34 AM
    I am tinkering around with Kotlin/Native and build a small piece of code that I'd like to release as a library to be used in my other projects. Can I just use the mavenPublish-Gradle plugin to publish it on mavenCentral or does it need additional setup or even a fully different approach?
    a
    h
    • 3
    • 6
  • a

    alexandre mommers

    11/17/2025, 12:03 PM
    Has anyone succeeded in running Knative on Android with the new 16KB memory page size mode? So far, all I’ve experienced is crashes or build failures when trying to fix it. I have reported here https://youtrack.jetbrains.com/issue/KT-77899/Update-Kotlin-Native-Android-NDK-toolchain since that seems related to the LLVM version.
    e
    • 2
    • 2
  • r

    rebok

    11/17/2025, 10:41 PM
    Does K/N support adding custom mem allocators or do i need to recompile K/N with the support for my allocator
  • m

    M.WAQAS

    11/19/2025, 5:59 AM
    Can anyone guide me on how to build a backend using Kotlin? I'm looking for proper implementation guidelines or a sample project showing how to create APIs and a complete app or web backend using Kotlin.
    l
    m
    +2
    • 5
    • 7