r/Kotlin • • 4h ago

How should I handle JNI type conversions in Kotlin/Native's nativeMain?

3 Upvotes

I'm working on a KMP project using Kotlin/Native and need to convert between Kotlin types (String, ByteArray, etc.) and JNI types represented by COpaquePointer in nativeMain.

Since nativeMain can't directly use JNI APIs through the usual JVM/JNI mechanisms, I'd like to avoid duplicating conversion logic across native targets such as Windows and macOS.

I tried manually accessing the JNI function table through COpaquePointer and invoking function pointers. For example, here's my implementation for converting between Kotlin String and jstring:

@OptIn(ExperimentalForeignApi::class)
fun String.kotlinStringToPointer(
    env: COpaquePointer?,
): COpaquePointer? {
    if (env == null) return null

    val envPointer = env.reinterpret<COpaquePointerVar>()
    val jniNativeInterfaceVar = envPointer.pointed.value ?: return null
    val functionTable = jniNativeInterfaceVar.reinterpret<COpaquePointerVar>()

    val newStringUTFPtr =
        functionTable.get(JniFunctionIndex.NewStringUTF) ?: return null

    val newStringUTFFunction = newStringUTFPtr.reinterpret<
        CFunction<(COpaquePointer?, CPointer<ByteVar>?) -> COpaquePointer?>
    >()

    return memScoped {
        val cString = this@kotlinStringToPointer.cstr
        newStringUTFFunction.invoke(env, cString.ptr)
    }
}

@OptIn(ExperimentalForeignApi::class)
fun COpaquePointer?.toKotlinString(
    env: COpaquePointer?,
): String? {
    if (this == null || env == null) return null

    val envPointer = env.reinterpret<COpaquePointerVar>()
    val jniNativeInterfaceVar = envPointer.pointed.value ?: return null
    val functionTable = jniNativeInterfaceVar.reinterpret<COpaquePointerVar>()

    val getStringUTFCharsPtr =
        functionTable.get(JniFunctionIndex.GetStringUTFChars) ?: return null
    val releaseStringUTFCharsPtr =
        functionTable.get(JniFunctionIndex.ReleaseStringUTFChars) ?: return null

    val getStringUTFChars = getStringUTFCharsPtr.reinterpret<
        CFunction<
            (COpaquePointer?, COpaquePointer?, CPointer<ByteVar>?) ->
                CPointer<ByteVar>?
        >
    >()

    val releaseStringUTFChars = releaseStringUTFCharsPtr.reinterpret<
        CFunction<
            (COpaquePointer?, COpaquePointer?, CPointer<ByteVar>?) -> Unit
        >
    >()

    val cStringPtr = getStringUTFChars.invoke(env, this, null) ?: return null

    return try {
        cStringPtr.toKString()
    } finally {
        releaseStringUTFChars.invoke(env, this, cStringPtr)
    }
}

The function table indices are defined in my JniFunctionIndex mapping, based on the JNI Functions specification.

Although this approach works in my current setup, manually maintaining the function indices and function pointer signatures feels fragile and error-prone.

I'd appreciate advice on the following:

  1. Is manually invoking JNI function pointers through COpaquePointer a reasonable approach for Kotlin/Native, or should it generally be avoided?
  2. Would expect/actual be a better approach, with JNI-specific conversions implemented in platform-specific source sets while keeping the public Kotlin API shared?
  3. Would using Kotlin/Native cinterop with jni.h, or introducing a C/C++ bridge, be a cleaner and more maintainable solution?

I'm particularly interested in approaches that let me share as much conversion logic as possible across Windows and macOS without introducing unnecessary platform-specific duplication.


r/Kotlin • • 5h ago

Best Projects Courses or Projects that AI can help me understand

Thumbnail
0 Upvotes

r/Kotlin • • 19h ago

KitePlayer v0.3.0: the first Kotlin/Native media playback engine for KMP that doesn't wrap ExoPlayer or AVPlayer underneath

Post image
10 Upvotes

Yes, a Kotlin/Native player as powerful as VLC and mpv

I maintain syncplay-mobile, a KMP app that wraps 4 different players: ExoPlayer and mpv on Android, and AVPlayer and VLCKit on iOS. After years of that, I can say the expect/actual wrapper model never clicked for me when it comes to media playback (each player seeks differently reports tracks differently and handles subtitles differently) so the glue layer keeps growing and growing, in the end you still end up with 4 different behaviours.

It's why I dropped the idea to leverage an interface to glue players together (many libraries already do that already) and set out to build a player on the level of mpv and VLC that is just as feature-rich, performant and efficient but behaves exactly the same on every platform: Android, iOS, desktop JVM, desktop native and web. What I ended up concocting (I love this word) is KitePlayer.

Why would you even consider it? Easy:

  1. It can render directly to the Compose/Skia canvas (still GPU-accelerated): there is no need for any interop views. But it does come with native views (like Android XML) if you prefer those that isn't a limitation either.
  2. FFmpeg comes embedded and is published on Maven Central. One dependency line gets you the full power of FFmpeg playback. You don't need to build from FFmpeg by yourself. The FFmpeg prebuilts are fully LGPL.
  3. iOS finally gets a decent player. AVPlayer can't play stylized subtitles or even MKVs, and VLCKit isn't much better since it's unpredictable and failed me every single time I needed maximum accuracy. There is simply no good player on iOS, not even in Apple's own Swift stack.
  4. It plays literally everything and behaves exactly the same on every platform. It's also coroutine-friendly and suspend-first which makes its behaviour very easy to predict. It uses Ktor for networking (HLS and DASH are fully supported). 4K, Dolby Vision, true HDR are also fully supported. 360° inital support is implemented but doesn't work on some of the targets, that's on the way as we speak.
  5. It has grown a lot in just 4-5 months. I've been working on it nonstop and testing it heavily, the development that would've taken years took just a few months thanks to the accelerated workflow with the help of Opus 5.5 and Fable 5.1. I've even shipped it in syncplay-mobile as one of the available engines, which says a lot about how reliable it is at this point. I wouldn't call it mature yet though, that's probably years away.
  6. You don't need a KMP project to use it. You can consume it from a plain Android app, an iOS app, a web app or a desktop app.
  7. Besides Ktor, its only dependency is KiteFFmpeg, the Kotlin/Native wrapper around FFmpeg.

All decoding goes through FFmpeg. That layer is its own library, KiteFFmpeg, in case you only need to transcode, remux or grab thumbnails. FFmpeg ships inside the artifacts, so it's just one Gradle line (no NDK and no build scripts).

My favourite part I like highlighting is the Compose/Skiko integration. You can host a native view like every other player does, but there is a second path where Compose draws the frames itself on the same canvas as the rest of your UI, thanks to Skia. The video no longer lives on a separate layer sitting outside your layout, which means you you can clip it, rotate it, animate it or blur it with Haze like any other composable.

PS: if you like the idea of rendering directly through Skia/Compose, KitePDF does the same for PDF and EPUB2/3. No more interop views, pretty please...

LIke I said, I hope this becomes the mainstream go-to choice for every one who has media playback in their app whether it is video-only or audio-only or both. KitePlayer at this point can do it all.


r/Kotlin • • 4h ago

I built an experimental Bitcoin futures trading simulator in just over a week with the help of 3 AIs — despite having very limited coding skills

0 Upvotes

Hey everyone!

I want to share a project I've been working on recently: an open-source Android app called **Bitcoin Futures Simulator**.

**GitHub repository:** https://github.com/Joapetis/bitcoin-futuros-android

Before anyone gets too excited, I want to be clear: this is an early-stage experiment, not a profitable trading bot. So far, its simulated trading results have generated more losses than profits. No real money has been involved.

**How it started**

The whole thing began with an old HTML project I had created some time ago and eventually abandoned. The idea behind it never really went away, though.

Recently, I decided to revisit that idea and see how far I could take it with AI assistance. What started as an abandoned project gradually evolved into a functional Android app in a little over a week.

There's a catch: **my programming knowledge is very limited.**

Instead of building everything myself line by line, I've been combining my own ideas, observations, strategy concepts and testing with the coding and debugging capabilities of three different AIs. They've helped generate, modify, review and polish the code throughout the process.

This has become an experiment in its own right. I want to explore not only whether I can turn my ideas into a working application, but also how capable AI systems are at building and improving a relatively complex software project with very little direct human coding.

I'm still the one setting the direction, making decisions, testing results and deciding what should change. The AIs do a substantial part of the coding, but that doesn't mean their output is automatically correct. Bugs, bad assumptions and poor trading results are all part of the process.

**What does the app actually do?**

The current project is an experimental Bitcoin futures paper-trading simulator for Android. Its main components include:

**A multi-timeframe strategy:** primarily focused on 15-minute candles, with 1-hour and 4-hour trend confirmation.

**Trend-following and mean-reversion logic:** different approaches depending on the detected market regime.

**Market microstructure data:** order-book metrics such as spread, imbalance and microprice-related signals.

**Optional on-device AI:** integration with Gemini Nano through Android's AI capabilities when a compatible model and device are available.

**Simulated trading and risk management:** intended to test strategies without risking real funds.

**Continuous experimentation:** the goal is to evaluate what works, identify weaknesses and improve the system over time.

The project is still very much in its infancy. There is plenty to question, test, refactor and improve, and I don't want to present any of its strategies as proven or profitable.

**Why am I sharing it?**

I'd love to turn this into something more collaborative.

If you're a developer, a quantitative trading enthusiast, an Android/Kotlin programmer, someone interested in market microstructure, or simply curious about what AI-assisted development can achieve, I'd genuinely appreciate your input.

You don't need to be an expert in every part of the project. Even identifying bugs, challenging assumptions, improving the architecture, reviewing the trading logic, suggesting better tests or documenting how things work could make a real difference.

My hope is that people can learn from the experiment, contribute their ideas and improvements, and help create something more useful together. In return, contributors get a real-world project to experiment with, review and learn from, while the wider community benefits from any improvements we can make.

I'm especially interested in honest criticism. If you see something fundamentally wrong with the strategy or implementation, I'd rather hear about it than receive empty praise.

**A few important caveats**

This is an experimental project, not financial advice.

All results discussed here are from simulated trading; no real-money trading is involved.

The current simulated performance is negative, so there's a lot of work left to do.

AI-generated code can contain bugs and needs independent review and testing.

The app is not ready to be treated as a reliable or profitable trading system.

If you'd like to explore the code, suggest an improvement, open an issue or contribute, you're welcome to check out the repository.

I'd love to hear your thoughts. Thanks for reading!


r/Kotlin • • 23h ago

Struggling with using webview for a html jscript file which reads local CSV files + saves local user data

Thumbnail
0 Upvotes

r/Kotlin • • 2d ago

📣 The Kotlin compiler is moving to JDK 17 as its minimum runtime.

64 Upvotes

The Kotlin compiler is moving to JDK 17 as its minimum runtime.

Here's the plan:
• 2.5.0-Beta1: A warning when you run the compiler on a JDK older than 17.
• 2.5.0-Beta2 and 2.5.0: An error, with a flag to keep using your current JDK for now.
• 2.5.20-Beta1 and later: JDK 17 or newer is required.

If your machines or CI still run the compiler on an older JDK, now is a good time to plan the update.

👉 If you have a use case we might be missing, tell us in KT-88173


r/Kotlin • • 1d ago

Is there any way to learn Kotlin for Android development?

0 Upvotes

Hey I’m learning android development and I’m having quite a bit of difficulty learning Kotlin. I know the basics but I struggle with building logic for Android apps using Kotlin. I also find it difficult to understand which concepts to use and when. How can i learn Kotlin more easily and improve my problem solving skills?


r/Kotlin • • 1d ago

I got tired of my AI agent writing Compose UI it couldn't see, so I built a tool that renders @Preview to PNG without the IDE

Post image
0 Upvotes

I use Claude Code a lot for Compose work. The annoying part was always the same: it writes a screen, says "done", and then I open Android Studio and the padding is off, text is clipped, or the dark theme is broken. It never saw the UI. It was guessing.

So, I built Spyglass. It renders your u/Preview functions to PNG from the command line, no IDE open.

spyglass render --filter LoginScreen

What it does:

  • Renders every u/Preview in a Compose Multiplatform project through your own Gradle wrapper. No changes to your build files.
  • Handles u/PreviewLightDark, u/PreviewParameter, font scale, device sizes, and multi-preview annotations from other modules.
  • Compares a render with a design image and tells you which regions differ, in dp, with a heatmap. So "make it match the Figma export" becomes something you can check.
  • spyglass approve / spyglass check gives you screenshot tests in CI. A one-digit text change fails the check.
  • Comes with an MCP server, so Claude Code, Cursor or anything that speaks MCP can render and look at the UI on its own and fix what it sees.

A few things I had to solve along the way that might be interesting:

  • Animations and delay() in fake data. A naive render catches the first frame, so you get a progress bar at 0% and a dialog half faded in. Spyglass runs previews on a virtual clock until everything settles, so a delay(300) before your fake data loads costs no real time and you see the loaded state.
  • A preview stuck in a loop used to hang the whole run. Now it gets cut off after 30 seconds and you get the exact line it was stuck on.
  • Token cost for agents. Images are sized down, and if nothing changed since the agent last looked, it doesn't send the image again. A repeat render went from about 1,560 tokens to about 180.

Limits, so nobody is surprised: previews need a JVM (desktop) target, so Android-only previews and Android-only APIs don't render yet. Text uses your OS fonts, so keep screenshot baselines from one OS. Tested on Windows, Linux and macOS.

It's MIT licensed and this is the first release (0.1.0). I'd really like to hear where it breaks on your projects.

https://github.com/zainkhalid91/spyglass


r/Kotlin • • 2d ago

KlassFile: A Kotlin DSL for JVM bytecode generation

Thumbnail github.com
12 Upvotes

Yes, chatgpt gave me the title because I have no creativity with naming things.

First of all, I'm not a native English speaker (I'm Portuguese), and I don't really like using AI to write. Most of the time, I only use it for translation, so it is what it is :)

I'm a Computer Science and Engineering student at ISEL, in Lisbon, Portugal. Last semester, I had a course that covered JVM reflection and bytecode generation in Kotlin.

I really love Kotlin, but using Java's ClassFile API from Kotlin was a pretty awful experience. So I built KlassFile (aka a Kotlin wrapper around ClassFile). Yes, it's ClassFile, but with a 'K' for Kotlin :)

My biggest issue with the Java API was that it relies on strings to represent types, descriptors, and other JVM concepts. Kotlin allows for a more type-safe API by using inline reified type parameters.

I also improved other aspects of the API:

  • Improved error reporting
  • Stack type checking at "compile time"
  • Automatic type inference in code scopes (return, add, load, store, etc.)
  • Automatic generation of a default no-argument constructor
  • Better loop syntax, with more convenient ways to define while and for loops
  • Easier generation of field getters and setters
  • Handles for methods, fields, parameters, and local variables, so they can be referenced and reused
  • Type safety (yes, again!)

I can't show you everything in this post, so I'll let you explore the examples and documentation yourself:

https://github.com/RafaPear/KlassFile

If you're into JVM bytecode generation, I think you'll enjoy using it!

I'd love to hear your thoughts and feedback!

Given how many AI-generated posts there are on Reddit nowadays, I want to clarify that I used zero AI to develop the library itself. As I mentioned at the beginning, I only used AI to fix spelling mistakes and help with translation, since English isn't my first language.


r/Kotlin • • 2d ago

Would anyone like to give me some advice?

Thumbnail
1 Upvotes

r/Kotlin • • 3d ago

I worked on a Kotlin debugger for VS Code that doesn't require a separate Kotlin Language Server

9 Upvotes

I've been exploring Kotlin development in VS Code and ran into a familiar problem: getting a comfortable debugging workflow isn't always straightforward.

There are extensions for Kotlin editing and language support, but I wanted something focused on debugging Kotlin/JVM projects without requiring a separate language server setup.

So I worked on an open-source Kotlin Debugger extension.

It supports:

  • Breakpoints in Kotlin source files
  • Step into / over / out
  • Local variable inspection
  • Call-stack navigation
  • Improved breakpoint handling for Kotlin/JVM

While testing the broader development workflow, I also came across Kotlin Jump, which is built by another developer.

It provides Kotlin indexing, navigation, and editing features without an LSP.

With both extensions installed, I can get navigation and debugging working together in VS Code.

A few caveats: my debugger currently focuses on Kotlin/JVM, requires an appropriate JDK/build setup, and coroutine debugging is still limited.

My debugger: https://marketplace.visualstudio.com/items?itemName=kparth01.kotlin-debugger

Kotlin Jump: https://marketplace.visualstudio.com/items?itemName=elumine.kotlin-jump

I'd be interested to hear from other Kotlin developers:

Are you currently using VS Code for Kotlin*, or have you moved to IntelliJ because of tooling limitations?*

Also, if you try the debugger, I'd genuinely appreciate bug reports or suggestions.


r/Kotlin • • 2d ago

Kotlin/Maven Library for symbolic computation, directed rounding, etc...

1 Upvotes

Whoever works with Kotlin and needs reachability analysis, symbolic execution, directed Rounding, Longs with limitation/overflow handling, etc: we have published a new release of AADD written in Kotlin MP on Github and Maven, targeting v1.0.0 😄

  • Completion of many missing functions,
  • More use of sealed classes,
  • Bugfixes.

For details see

https://github.com/tukcps/Multiplatform-AADD

includes documentation and some examples.
To use it, just add:

implementation("io.github.tukcps:aadd:0.9.13") // Check for newer versions!

Enjoy!


r/Kotlin • • 2d ago

Opt-in implicit construction for value classes

Thumbnail
0 Upvotes

r/Kotlin • • 4d ago

Compose DND 1.0.0-alpha02 is out, new big update

Post image
12 Upvotes

Compose DND 1.0.0-alpha02 is out 🎉

• Reorder that feels right.
• Kanban boards example.
• Auto-scroll on lists, grids and staggered grids.
• Axis lock, drag handles, conditional drop targets, drop strategies and multi-select drags.

Github: https://github.com/MohamedRejeb/compose-dnd
Web live demo: https://mohamedrejeb.github.io/compose-dnd/demo/
Docs: https://mohamedrejeb.github.io/compose-dnd/


r/Kotlin • • 4d ago

Concise, Multiplatform, and Oracle-free

Post image
6 Upvotes

kinda….


r/Kotlin • • 5d ago

I built Telar, an open-source Kotlin Multiplatform library for AI agent workflows as typed graphs (early alpha, feedback wanted)

0 Upvotes

I wanted to build agent workflows in Kotlin the way LangGraph does it in Python: as a graph where each step is visible and you decide what runs next. I also wanted it to run on small devices and in the browser, not only on a server, so I wrote my own. It is called Telar, it is Apache 2.0, and it is an early alpha.

The idea in one example

The state is your own data class, a node is a suspend function that returns a copy of it, and arrows connect the nodes. This workflow stops before money moves and continues when a person says yes:

data class Refund(val orderId: String, val amount: Int, val approved: Boolean = false, val status: String = "new")

val refunds = StateGraph<Refund> {

    val check = node("check") { it.copy(status = if (it.amount > 1000) "too large" else "checked") }

    val pay = node("pay") { it.copy(status = if (it.approved) "paid" else "rejected") }

    val decline = node("decline") { it.copy(status = "declined") }

    START then check
    conditionalEdge(check, targets = setOf(pay, decline)) { if (it.status == "checked") pay else decline }
    pay then END
    decline then END

}.compile() // a node nothing leads to, or a target that is not declared, fails here

suspend fun main() {
    val config = GraphConfig(threadId = "order-1001", checkpointer = MemoryCheckpointer<Refund>(), interruptBefore = setOf("pay"))

    // runs "check", then waits before "pay"
    refunds.invoke(Refund("1001", amount = 250), config)
    // a person said yes
    val result = refunds.resume(config) { it.copy(approved = true) }
    // paid
    println(result.state.status)                                     
}

That part needs only telar-core, which depends on kotlinx-coroutines and nothing else.

What it does today

  • Graphs: loops, parallel nodes, subgraphs, and a stream of events while a run is going
  • Save points: a checkpoint after every step, in memory, in a file, or in the browser's localStorage. A run can pause, survive a restart, and be forked from an earlier step
  • Agents: a ready-made tool-calling agent (toolAgent). You give it a model and a list of tools, and a tool's input is a @Serializable class that becomes the JSON schema
  • Models: Claude, and anything with the OpenAI API (OpenAI, Gemini, Ollama, Groq and so on) on Ktor client, plus an adapter for LangChain4j models on the JVM
  • Targets: JVM, Android, iOS, macOS, Linux, Windows, JS and Wasm

What it is not

Stable, or complete. There is no MCP, no tracing, no retry policy and no database checkpointer yet, and the API can still change before 1.0.

If you need a finished agent platform today, Koog is the safer choice, and LangGraph4j and LangChain4j are both at 1.x on the JVM. Telar is for the case where the workflow itself is the hard part and you want its state to be ordinary Kotlin. There is a comparison table on the site, and I would like to hear where it is wrong.

Try it

To see graphs run without writing code or bringing an API key, there is a small game in the browser, written in Compose Multiplatform for Wasm, where every stage is a Telar graph.

The feedback that would help me most right now is about the API: the graph DSL, how state is merged when nodes run in parallel, and what you would need before trying it in a real project.


r/Kotlin • • 6d ago

What I've learned about UI and logic sharing in Compose Multiplatform desktop apps

Thumbnail
6 Upvotes

r/Kotlin • • 6d ago

Learning Kotlin for Android app dev, what things should I focus on learning?

10 Upvotes

I am working on making my first app using Kotlin, I have limited expereince in a few programming languages (although I still find object oriented difficult), what should I focus on learning? So far I have been going through the W3 schools material, can I get away with not using object oriented code when making an app? Is there anything else you would reccomend me learning? I'm curious about how to make the user interface with this language for example and how you convert the file into an actual app that can run and send notifications etc on a mobile phone.


r/Kotlin • • 7d ago

Spotted in London tube (Northern line) yesterday.

82 Upvotes

r/Kotlin • • 6d ago

Which native Android app would be best to build as a beginner that is valuable and profitable?

Thumbnail
0 Upvotes

r/Kotlin • • 7d ago

How can I secure my desktop app?

2 Upvotes

I've been developing a desktop app using KMP, and when I packaged the release distribution, I found out that the installer include the jar file in the installation directory, which is easier to exploit even when using proguard for obfuscation.

Is there any better solution for that?


r/Kotlin • • 7d ago

I made a customizable squircle bottom navigation bar for Android (SqNav)

Post image
2 Upvotes

r/Kotlin • • 8d ago

What makes a developer conference worth your time in the AI era?

Post image
57 Upvotes

TL;DR: Take our five-minute survey on developer conferences and enter the draw to win one of 3 KotlinConf 2027 tickets.

Hi! I'm part of the KotlinConf team, and we'd love your input as we plan future events.

Software development is changing so quickly. For us, meeting in person to share first-hand experience and fresh perspectives feels more valuable than ever.

What about you? Is it the technical deep dives, conversations with the actual humans behind the tools, or meeting other developers working on similar problems? Or the party, which is still AI-proof, we hope :)

We've put together a five-minute survey about what would make KotlinConf worth your time, from the program to the experience beyond talks (you don't need to have attended before).

Take the survey: https://surveys.jetbrains.com/s3/KotlinConf-Survey2026

🎁 After completing it, you can enter a draw to win one of three tickets to KotlinConf 2027


r/Kotlin • • 8d ago

KitePlayer v0.3.0 is out! HLS, DASH, HDR now fully supported on every KMP target

Post image
40 Upvotes

KitePlayer 0.3.0 is released.

KitePlayer is a pure-Kotlin media playback engine for KMP. It doesn't wrap any platform player and doesn't use expect/actual: the whole engine lives in commonMain so it behaves the same on every platform. As far as I know, it's currently the only KMP playback library that draws its frames directly to Compose via Skiko, fully hardware accelerated, with no performance compromise.

It has received a lot of love lately and is growing fast. The goal is to cover as much ground as the well-known players (VLC, mpv, etc.) while being just as efficient. FFmpeg still does the heavy lifting underneath (through KiteFFmpeg, which ships prebuilt FFmpeg binaries for all KMP targets and is a single implementation line away on Maven Central). So the main difference between Kite and VLC is how FFmpeg gets called (from Kotlin instead of through another C binding), which means format support is on par and performance is almost exactly the same.

What's new in 0.3.0

  • HLS and DASH streaming full support
  • True HDR on all platforms (except web)
  • More protocols: RTSP, RTMP, UDP, RTP
  • More niche subtitle formats
  • Pitch-accurate speed change control
  • Internal playlist queuing (M3U, PLS, XSPF)
  • An animation upscaler (ported Anime4K logic, running on the Android and Metal renderers)
  • Windows decoding via DirectX 11

...and a lot more. The scope of changes since 0.2.0 is too big to list in full.

It also integrates libass and dav1d, so AV1 and SSA/ASS subtitles are fully supported on all platforms as well.

The part I'm proudest of is painting frames directly to a Compose surface with Skiko while the GPU still does all the work. Your video becomes part of the Compose tree, so you can treat it like any other composable, and even blur it with Chris Banes' Haze library.

I still provide native views and a compose-interop view anyway. The library is fully consumable as a standalone Java library, and I'm aiming to make it consumable from exclusive-platform native apps such as exclusive iOS apps via a Swift library, or on the web as a JS library, etc, exercising the grand benefit that KMP blesses upon us.

So you no longer need to write expect/actual wrappers over ExoPlayer, AVPlayer and the rest. I hope this comes in handy, and I'm pretty sure it will :)

Feedback and feature requests are very welcome.


r/Kotlin • • 8d ago

Lights, Kotlin, Action! Run Kotlin scripts in GitHub Actions with Java, Kotlin, and caching handled for you.

Thumbnail github.com
7 Upvotes

I've been using .main.kts for a while. In the era of coding agents, I've started using these scripts even more as replacements for Ruby, Python, and JavaScript scripts in Kotlin projects.

One thing I hadn't realized was how tedious running them in GitHub Actions could be. You have to set up the JVM and Kotlin just to run a single Kotlin script and don't forget the caches.

So I built this action and replaced the repetitive setup in my repositories with a single action that sets up the JVM, Kotlin, and caching. Now, running scripts is as simple as these few lines:

steps: - uses: actions/checkout@v7 - uses: Heapy/setup-main-kts@v1.0.1 - run: kotlinr scripts/example.main.kts

On the performance side, setup takes about 9 seconds (median), with observed times ranging from 4 to 18 seconds. Execution time depends on what your script does, but my fastest script takes about 1 second, and since it's just a JVM with a JAR - it scales ok for most workloads you may need.