https://kotlinlang.org logo
Join Slack
Powered by
# forum
  • r

    rss

    09/03/2025, 4:19 AM
    Intellij plugin for Kotlin script definitions I’m trying to make a plugin to add a custom script definition to IDEA. I’ve managed to make a script definition show up without any plugins if I have the project that contains the script definition loaded, but I’d like a more permanent solution. Right now I have the script definition package dev.fishies.cohoplugin import kotlin.script.experimental.annotations.KotlinScript import kotlin.script.experimental.api.ScriptAcceptedLocation import...
  • r

    rss

    09/04/2025, 5:59 PM
    Lsp + mcp Has anyone used the Kotlin LSP with MCP? 1 post - 1 participant Read full topic
  • r

    rss

    09/10/2025, 5:09 PM
    BottomModalLayout OnDismiss is closing on clicking outside the scrim val scope = rememberCoroutineScope() val sheetState = rememberModalBottomSheetState( skipPartiallyExpanded = true, confirmValueChange = { it == SheetValue.Expanded } ) val is_open = remember { mutableStateOf(false) } if(!is_open.value) { ModalBottomSheet( onDismissRequest = { }, dragHandle = null, sheetState = sheetState, modifier = Modifier.wrapContentSize(),...
  • r

    rss

    09/15/2025, 1:29 PM
    Black screen issue for the iOS platform during screen switch Hi, KMP community, during the development of the KMP + Compose UI application, I encountered an iOS-only UI issue. The problem looks like, when using the application in some random moment of the time, screens stay black, and when I click to another tab in half a second, I see the past screen and then the black screen, it’s also strange moment because during the click to a new tab I should see on the second current screen not a past screen. Also, one of my screens has a player with auto start....
  • r

    rss

    09/15/2025, 3:09 PM
    Throws annotations for Objective-C interop Hi, I have a quick question about exception handling when calling a Kotlin function from Swift/Objective-C code. Do I need to annotate all functions, including nested and helper functions, or is it enough to annotate only the public (API) function that is called from Swift? Best regards, Sven 1 post - 1 participant Read full topic
  • r

    rss

    09/19/2025, 2:39 AM
    Java 25 compatibility Any plans to support Java 25 now that gradle has released 9.1.0 with full support? 1 post - 1 participant Read full topic
  • r

    rss

    09/19/2025, 8:19 AM
    Is the new WebElementView meant for replacing usage of native web views? I see that Compose Multiplatform 1.9 has just released with the introduction of the new WebElementView New API for embedding HTML content I’m making a Compose Multiplatform (targeted to iOS and Android) that’s just a wrapper to one of our existing SPA web apps. I’m using WKWebView on iOS and WebView on Android, giving them both a URL...
  • r

    rss

    09/23/2025, 10:29 PM
    Why is method with vararg param selected when passing named arguments? Consider this code: class Log { private fun print(input: String, params: String) { println("${input.padEnd(15)}-> $params") } fun debug(input: String, vararg data: Any) { print(input, "vararg data: Any") } fun debug(input: String, data: Any) { print(input, "data: Any") } } fun main() { val log = Log() log.debug("data = [data]", data = arrayOf("data")) log.debug("[data]", arrayOf("data")) } The output is: data = [data] -> vararg...
  • r

    rss

    09/27/2025, 1:49 PM
    Access protected member of another instance of a superclass I have the class O that defines the protected field code. I have the class BO that extends O. In a method of BO that takes a BO as a parameter, I can access this.code and other.code. But in a method of BO that takes an O as a parameter, I can access this.code but not other.code. Why ? 1 post - 1 participant Read full topic
  • r

    rss

    09/28/2025, 2:29 PM
    Value class box-impl override When int is converted into Integer (autoboxing), compiler calls public static Integer valueOf(int i); When underlying field is converted into an instance of the value class, the compiler calls ValueClass.box-impl method which just wraps constructor. I would like to implement cache in similar way as Integer does, but I cannot override the method. I tried sth with e.g. @JvmName @JvmStatic, but result method returns the underlying field instead of instence of the class and then it is not called...
  • r

    rss

    09/28/2025, 6:49 PM
    Difference between function type with receiver and extension function Consider the following functions: fun Int.ext() { // TODO } fun doSomething(f: Int.() -> Unit) { // TODO } The functional parameter f has the same type as the extension function ext. So, I can do this: doSomething(Int::ext) The question is… In the body of doSomething function, I can do this: fun doSomething(f: Int.() -> Unit) { 42.f() // OK f(42) // OK } But when I call the ext function, this happens: 42.ext() // OK ext(42) // compiler error Why does that...
  • r

    rss

    10/01/2025, 9:49 AM
    Unbelievable error message after compile Hello everybody¡¡ I’m starting to learn different aspects about programming in kotlin. Sometimes I recive this confussin error message, I don’t understand it. can anybody explain me it??

    https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/c/cd4112d7518cc6bc9f05d0fb9b4db972c0b67616.png▾

    but if I open the generated class after...
  • r

    rss

    10/02/2025, 3:29 AM
    Accessibility iOS traversal order inconsistent? I’m not sure if I’m opening this in the right place but I’ve been banging my head against the wall for over a month on this I’ve got a compose scrollable column with some items, and I can’t make accessibility navigation go through them in the order they’re laid out - specifically on iOS. Android works perfectly whether I define traversalIndex or not. What’s worse is it’s inconsistent. The slower I traverse (with accessibility swipes) the better it works, but never 100% and eventually it just...
  • r

    rss

    10/02/2025, 4:09 PM
    Mismatch between glibc versions (Kotlin/Native on Linux) Consider the following example: Project foo is a KMP library with cinterop dependencies. The dependencies are built with system toolchain and target system libraries, e.g. glibc > 2.20 Project bar is a KMP / KN executable with a dependency on foo. When konan is invoked to build and link bar, it uses its own bundled LLVM and sysroot The sysroot bundled with konan (available in ~/.konan/dependencies) is heavily outdated (kernel 4.9.2, glibc 2.19) even though the LLVM toolchain is relatively...
  • r

    rss

    10/12/2025, 6:39 PM
    A syntax-level support for reactive ref type A reactive pipeline is very commonly used in various sicarios. In frontend development, we use such pipelines to bind the states and views in many ways. For example, we have ref and computed in Vue. We have re-executing mechanism in React and Compose. In server side development, we use streams and flows to process sequential data. However, to define the reactive pipeline is not that intuitive. For example, to define c=a+b, we have to write a lambda with explicit specifications. The lambda...
  • r

    rss

    10/13/2025, 7:59 AM
    Is it possible to configure demand delivery in KMP project I’m working on a Kotlin Multiplatform (KMP) project and want to explore whether it’s possible to configure on-demand feature delivery, similar to Android’s Play Feature Delivery or Play Asset Delivery. The idea is that we have a super app consisting of multiple modules say four independent apps/features and I want to separate each one so that when the user selects a specific app, it’s downloaded on demand and then opened directly within the same super app. I’d like to know: Can a KMP...
  • r

    rss

    10/13/2025, 10:19 AM
    I need guidence regarding navigation in KMP We have a native Android app that is mostly WebViews and uses Jetpack Navigation. We want to start migrating to fully native screens using Kotlin Multiplatform (KMP) to share both logic and UI between Android and iOS. None of us on the dev team has prior KMP experience. My assumption is the following: we could create a KMP module for, say, SSO, which uses <a href="https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-navigation-routing.html" rel="noopener nofollow ugc">Compose...
  • r

    rss

    10/15/2025, 6:39 AM
    C++ Library for Desktop Build I just started to learn KMP and I want to see how to integrate C++ code into my project. I successfully edited the build.gradle.kts to build a C++ library for Android and have called a JNI function in the library. // composeApp/build.gradle.kts android { ... externalNativeBuild { cmake { path = file("src/main/cpp/CMakeLists.txt") version = "3.22.1" } } But the desktop version is not able to do the same. If it helps. So far I added the...
  • r

    rss

    10/16/2025, 10:19 PM
    Delete / clear account I like to periodically scrub my online presence. I don’t mind the content going on to exist, but I would like the username to be replaced by [deleted account] or something similar. The profile page doesn’t allow me to edit things like user handle or delete the entire account. Please make that an option. 1 post - 1 participant Read full topic
  • r

    rss

    10/20/2025, 12:19 PM
    Errors running kotlin class from comd-line hello everyone, I’m trying to run a kotlin class from CLI(Kotlin command-line compiler | Kotlin Documentation), but I get some errors: <a class="lightbox" href="

    https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/f/f438507ef51a0277699e86512589ac5b9ca5d72f.png▾

    " data-download-href="/uploads/short-url/yQt9FkSlyIuDtl0KwFEiQ12KAgL.png?dl=1" title="image" rel="noopener...
  • r

    rss

    10/23/2025, 8:39 AM
    Real-world health &amp; posture app built with Compose Multiplatform + Ktor (Android, iOS, Backend) Hi everyone I wanted to share my production app StandProud — a real-world fitness app focused on posture correction and back-health improvement, built entirely with Compose Multiplatform and Ktor (Android, iOS, and backend). The app helps users improve posture and reduce back pain through science-based workouts. It’s already live on both app stores and running in production. Tech stack: Compose Multiplatform (UI), Kotlin Multiplatform architecture, Ktor backend (Google Cloud Run +...
  • r

    rss

    10/24/2025, 11:49 PM
    How to use SQLite without GUI? only print console With the GUI, everything is fine, but when I try to do it without the GUI, I get errors. Is this possible? I'm new to Kotlin. Thank you very much. 1 post - 1 participant Read full topic
  • r

    rss

    10/27/2025, 2:59 AM
    Should I convert from Groovy DSL to Kotlin DSL? I have an Android application with Groovy DSL. Should I convert it to Kotlin DSL, and does anyone know how to convert from Groovy to Kotlin? 1 post - 1 participant Read full topic
  • r

    rss

    10/27/2025, 5:39 AM
    Error on pausing / resuming / stoping the audio class AudioSource constructor ( context: Context ){ private val mediaRecorder = MediaRecorder(context) private val outputFile = File(context.getExternalFilesDir(Environment.DIRECTORY_MUSIC),"sample.mp4") fun start(): String? { try { mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC) mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP) mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB)...
  • r

    rss

    10/27/2025, 6:19 AM
    What's an idiomatic way to name a function that takes `() -&gt; Unit` vs `suspend () -&gt; Unit` I’m trying to get up to speed with Kotlin. One of the things I keep hitting snags with is how functions and suspend functions feel like oil and water and don’t mix. For example if I wanted to wrap some code like this: time { doSomething } I apparently can’t have it work regardless of whether doSomething is suspend or not: package meh; // I'm not really trying to time code; I'm actually trying to specialize assertFails // This is just a minimum reproducible program that demonstrates where...
  • r

    rss

    10/28/2025, 4:59 PM
    Understanding Primitive Classes in Kotlin In Kotlin, everything looks like an object, but behind the scenes, the compiler is smart enough to use primitive types where possible for better performance. Let’s explore how Kotlin’s primitive-like classes such as Int, Double, Boolean, and String actually work. What Are Primitive Classes? Primitive classes in Kotlin are lightweight, built-in types that represent basic data. They behave like objects but are compiled down to primitives (like int, double) on the JVM for efficiency. Example:...
  • r

    rss

    10/31/2025, 12:49 PM
    withContext breaks coroutine supervision I have the following exception handler (just as example): class StatefulCoroutineExceptionHandler( private val logging: Boolean ) : CoroutineExceptionHandler { val throwables = mutableListOf() override val key: CoroutineContext.Key = CoroutineExceptionHandler.Key override fun handleException( context: CoroutineContext, exception: Throwable, ) { if (logging) { log.error("{} - {}", exception.javaClass.canonicalName, exception.message)...
  • r

    rss

    10/31/2025, 2:09 PM
    BOB Conference 2026 - Call for Contributions, Early tickets available https://discuss.kotlinlang.org/#p-80208-what-happens-when-we-use-whats-best-for-a-change-1“What happens when we use what’s best for a change?” https://bobkonf.de/2026/cfc.html Berlin, Mar 13 Deadline: November 17, 2025 <a name="p-80208-looking-for-speakers-2" class="anchor"...
  • r

    rss

    11/02/2025, 4:09 PM
    Problem of mutating data class for use in Jetpack Compose The problem: The difficulty of maintaining the “stability” of large classes for Compose and mutability. The inevitability of the boilerplate code. I ran into the problem that Kotlin together with Jetpack Compose cannot handle working with large data models. Real cases often requires the declaration of many large classes in which there are several dozen fields. Example: Let’s imagine that we have a report document that contains many tables, lists, calculations and about 400 fields in total....
  • r

    rss

    11/04/2025, 6:49 AM
    Using multiple KMP modules in Swift For simplicity’s sake let’s consider a following dependency graph: kmpA (depends on kmpB) kmpB (no deps) swiftC (depends on kmpA and swiftD) swiftD (depends on kmpB) I’m trying to pass an object of type X (declared in kmpB) from swiftC to swiftD. Looking at mismatch type compiler error it seems that when kmpA and kmpB are built into xcframework they both expose type X with a different prefix kmpAX and kmpBX so essentially compiler sees them as 2 different types even though they have a...