r/Kotlin

@r_kotlin · сообщество · 1 подписчик

Записи из Reddit: https://www.reddit.com/r/Kotlin/ · импорт O2. Удалить запись — «Пожаловаться» в её меню.

Подписаться в O2
r/Kotlin
Why does StateFlow sometimes emit a value without updating the UI the way I expect?

I've been revisiting how StateFlow behaves in Android apps, particularly when a UI doesn't seem to react to an update.

One detail worth checking is equality: StateFlow suppresses consecutive values that are equal according to equals().

Other things I'd investigate:

• Is the UI collecting the correct StateFlow?
• Is collection lifecycle-aware?
• Is the state being mutated in place rather than replaced?
• Is the collector running in the expected scope?
For anyone who's debugged this in production, what was the actual cause in your case?

— u/byteVikas
Источник: reddit.com ↗
r/Kotlin
Lessons from 10 months of building a Kotlin + Quarkus app compiled to a native image

Hi r/Kotlin (https://www.reddit.com/r/Kotlin),

For the past 10 months I've been building an open-source uptime monitoring tool in Kotlin on Quarkus, compiled to a native image, with PostgreSQL used as a job queue to coordinate several workers. Here are a few Kotlin-specific things I ran into, in case they save someone time, and I'd love to hear how you handle them.

1. Native image and serialization

Classes serialized with a snake_case naming strategy have to be explicitly registered for reflection in the native build. In JVM mode everything worked; in native mode the JSON field names silently differed from the API. Nothing failed at build time, so it only showed up at runtime.

2. LocalDateTime vs Instant

I started with LocalDateTime and ended up replacing it with Instant everywhere. With checks running on several workers and notifications formatted in the user's timezone, keeping everything in UTC and converting only at display time removed a whole class of bugs.

3. Concurrency around token refresh and shutdown

Concurrent token refreshes caused race conditions until I added locking. I also had to implement a graceful shutdown for executors with timeouts, so that in-flight checks finish cleanly when a worker stops.

4. Rotating an encryption key

Stored credentials (SMTP passwords, webhook secrets…) are encrypted. Supporting key rotation meant writing a re-encryption service that decrypts with the old key and re-encrypts with the new one without downtime.

Questions for you

• Do you rely on Quarkus/GraalVM reflection config, or do you avoid reflection entirely (e.g. kotlinx.serialization)?
• How do you structure coroutines vs Quarkus executors in a long-running scheduler?
• Any idiomatic Kotlin patterns you'd recommend for this kind of worker/queue design?
The code is here if you want to look at the details: https://github.com/TheoMeunier/uptime-kotlin

— u/isoxxxx
Lessons from 10 months of building a Kotlin + Quarkus app compiled to a native image

Hi r/Kotlin (https://www.reddit.coИсточник: reddit.com ↗
r/Kotlin
Do you use AI coding tools for Android dev, and do they help or get in the way?

I am learning Kotlin and wonder if using AI tools while learning is a good idea or if it slows you down. How do you use them in your own work?

— u/dark_devil307
Источник: reddit.com ↗
r/Kotlin
Found a way to run gradle on musl-based systems

Ссылка: https://elisoli.fly.dev/posts/gradle-on-musl

— u/EliSoli
Источник: reddit.com ↗
r/Kotlin
I spent already much time building Sparrow — a decentralized, E2E-encrypted messenger using KMP, Compose Multiplatform, and a federated Ktor stack. Looking for architecture review and feedback

Hey everyone!

I'm an Android developer with over 12 years of experience, and I've been working on a personal project called Sparrow — a privacy-focused messenger built with Kotlin Multiplatform and Compose Multiplatform.

The idea behind Sparrow is simple: What if messaging didn't have to depend on a single company controlling the entire infrastructure?

Instead of building another centralized chat app, I wanted to explore a decentralized architecture using a 100% Kotlin ecosystem on both the client and the server side.

What Sparrow offers:

• 📱 Kotlin Multiplatform architecture (Android as the usable target, iOS planned)
• 🎨 Declarative UI built with Compose Multiplatform & Material 3
• 🏗️ Structured DI via Koin and durable client storage via Room + SQLite
• 🌐 Federated, independently hostable transport network powered by a Ktor server stack
• 🔐 End-to-end encryption using libsodium (X25519, Ed25519, ChaCha20-Poly1305)
• 💬 Private and group conversations with extensive feature sets (polls, shared expenses, link previews)
• 🔑 Identity verification using QR codes and safety numbers
A little about the architecture:

The architecture is highly modularized. Every conversation write and incoming packet runs as a dedicated state machine through our :feature:conversationorchestration modules, separating business logic completely from the UI layer (Chats only reads data and submits commands).

The project separates infrastructure into Directory services, Control Planes, and Community Nodes to prevent single points of failure.

Why am I posting here?

I've spent a lot of time designing and implementing Sparrow, but building something alone has its limitations. As a fellow Kotlin developer, I would highly value a rigorous review of my code structure and architecture choices.

I'm now looking for people who are interested in:

• Reviewing the KMP structure and the conversation orchestration state machine
• Downloading and testing the Android build
• Reviewing the Ktor backend integration and federation queues
• Reporting bugs and suggesting architectural improvements
Sparrow is currently proprietary, but the source code is available for inspection, building, and non-commercial evaluation. It's not being presented as an open-source project.

I'm not claiming Sparrow is ready to replace Signal. It's an independent project with plenty of room to improve. I'd genuinely appreciate constructive criticism, especially from developers who have worked on messaging systems, clean architectures, or distributed systems.

🔗 GitHub: cbgm/Sparrow (https://github.com/cbgm/Sparrow)

Medium Series getting updated by time: Sparrow: Private Conversations, on Infrastructure You Can Host (Part 1) | by Christian Bergmann | Oct, 2026 | Medium (https://medium.com/@c85bergmann/sparrow-private-conversations-on-infrastructure-you-can-host-part-1-40817ba913c6)

What do you think? How does this stack up as a real-world example of what a full-stack Kotlin ecosystem can achieve?

— u/didyouseethegoeffel
I spent already much time building Sparrow — a decentralized, E2E-encrypted messenger using KMP, Compose Multiplatform, Источник: reddit.com ↗
r/Kotlin
Gradle vs Kotlin Toolchain: Project Structure Side By Side

I like how the Kotlin Toolchain flattens the project structure. Plugins and feature code now sit two levels higher, the version catalog moves to the project root, and the deep source-set and package folders are gone. Fewer nested folders make the KMP project clearer and easier to navigate 🙃

I was also able to migrate my side project quite smoothly.

Kotlin Toolchain

https://kotlin-toolchain.org/latest/

Test Projects

https://github.com/igorwojda/kmp-showcase

https://github.com/igorwojda/kmp-showcase-kotlin-toolchain/

— u/Panel_pl
Gradle vs Kotlin Toolchain: Project Structure Side By Side

I like how the Kotlin Toolchain flattens the project structuИсточник: reddit.com ↗
r/Kotlin
Are there jobs in market for KMP?

Recently it's bothering me as very few companies are adapting KMP, and moreover Android developers are mostly working on the Kmp project, and as it's new learning mostly they don't switch.

Also now, using AI companies are using AI to build native applications. They are asking the developer to use Cursor / Claude to give the promt and ask AI agent to perform same task on both.

Meaning a developer can work on both platforms as native using AI.

So, is KMP relevant in today's market???

— u/ranjan96
Источник: reddit.com ↗
r/Kotlin
I wonder how many Kotlin developers use Kotlin for backend development and how they use it.

rom your perspective, how are Kotlin developers distributed across different areas, such as Android, backend, desktop, and others?

I've been using Kotlin for backend development (web apps, websites, and microservices) for some time, and I'm curious how others are using it in this area.

For example, are you using Ktor, Jetty, or a framework or application server you've built yourself to meet your specific needs?

If you're doing backend development with Kotlin, please share your setup.

Here's mine:

• Framework: A small custom framework built on Jetty
• Database: PostgreSQL
• OS: Ubuntu
• Dependency injection: Dagger
• Template engines: Velocity and JTE
• Admin panel: AdminLTE

— u/ogrebgr
Источник: reddit.com ↗
r/Kotlin
I built an open-source Kotlin + Compose app that runs ADB from your phone to debloat Android TVs (no PC, no root)

I got tired of the ads and preinstalled junk on my projector, and every fix needed a laptop and adb commands. So I built Tellyscope: a phone app that talks to Android TV, Google TV and Fire TV over Wi-Fi debugging and does it in a few taps.

What it does: turns off bloat from tested per-TV lists (300+ devices), sideloads APKs and split bundles, sends files, shows who else has ADB access, and works as a remote all in under 3MB of size.

How it's built:

- 100% Kotlin + Jetpack Compose, Material 3 Expressive

- The ADB side is a plain Kotlin/JVM module (no Android deps) on top of kadb, with coroutines throughout, so it's unit-tested without an emulator

- Android 11+ wireless debugging with pairing codes, plus classic port 5555

- For key presses, typing and screen off, a tiny helper runs on the TV via app_process and is deleted when you close the remote. No root.

- Screenshot tests with Roborazzi + Robolectric

- No Play Services, no Firebase, no analytics. GPL-3.0.

I'm not getting anything out of this except bug reports, and that's what I need. Code review, "this is the wrong way to do X", or "it broke on my TV" are all welcome.

GitHub: https://github.com/man15h/tellyscope

APK: https://github.com/man15h/tellyscope/releases/latest

— u/manish9461
Источник: reddit.com ↗
r/Kotlin
Built & Monetized 2 Native Android Apps using Kotlin & XML (Quiz Prep & 2D Arcade Game) - Sharing my experience & looking for feedback!

Hey everyone! As an indie developer, I recently built and deployed two native Android applications using Kotlin and Android Studio, focusing on performance and monetization integration.

1. Tech & Placement Quiz App

• Features: Curated questions covering DSA, Core CS, Quantitative Aptitude, and Current Affairs. Built with dynamic deduplication logic using SharedPreferences to prevent repeating questions in sessions.
• Monetization: Integrated Start.io (http://Start.io) SDK.
2. Sky Dash (2D Arcade Game)

• Features: A smooth 2D flyer game built with custom GameView frame-rate physics and dynamic obstacle generation.
• Monetization: Integrated Start.io (http://Start.io) / AppLovin SDKs.
Links & Playable Versions:

• You can check out and test the apps on my itch.io (http://itch.io) / Amazon Appstore page here: https://ankursinhagames.itch.io/sky-dash
• You can check out and test the apps on my itch.io (http://itch.io) / Amazon Appstore page here: https://ankursinhagames.itch.io/quiz-app
I would love your honest feedback on the UI layout, performance, and user experience! Let me know what you think.

— u/AnkurSinhaGames
Источник: reddit.com ↗
r/Kotlin
Is it still worth learning native Android (Kotlin) in 2026 or should a beginner go straight to cross-platform?

Ссылка: /r/androidapps/comments/1xfnmo4/is_it_still_worth_learning_native_android_kotlin/

— u/dark_devil307
Источник: reddit.com ↗
r/Kotlin
Free Kotlin Learning site with Promo Code : FIRST100

https://andrewaboalhana.github.io/kotlinGym/

— u/AndrewAboAlhana517
Free Kotlin Learning site with Promo Code : FIRST100

https://andrewaboalhana.github.io/kotlinGym/

— u/AndrewAboAlhana5Источник: reddit.com ↗
r/Kotlin
Free Subscription For Kotlin Learning site

Promo code : FIRST

FREE SUBSCRIPTION LIFETIME FOR FIRST 20 users

Ссылка: https://andrewaboalhana.github.io/kotlinGym/#/t/f-fun

— u/AndrewAboAlhana517
Источник: reddit.com ↗
r/Kotlin
Free Subscription For Kotlin Learning site

Promo code : FIRST

FREE SUBSCRIPTION LIFETIME FOR FIRST 20 users

Ссылка: https://andrewaboalhana.github.io/kotlinGym/#/t/f-fun

— u/AndrewAboAlhana517
Источник: reddit.com ↗
r/Kotlin
NetPulse: a small Android app for live ping, jitter and packet loss (beta, looking for feedback)

I've been building NetPulse, a lightweight Android app for checking your network quality. It has a Material 3 interface with light and dark themes.

What works in v0.1.0-beta:

- Live ICMP ping monitor with Start / Stop

- Latency, min / average / max, jitter and packet loss over the last 300 samples

- Only two permissions (INTERNET and ACCESS_NETWORK_STATE), no ads, no analytics, nothing uploaded

What's coming next: a DNS benchmark (Cloudflare, Google, Quad9, Control D) measured separately from ping, latency charts, test history and CSV export.

The app uses the system ping tool, so some phones may block it. That's the main thing I want to find out: does it work on your device? Please tell me your phone brand and Android version, and any bugs or features you'd like to see.

Beta APK: https://github.com/Mireli5656/NetPulse/releases/tag/v0.1.0-beta

Source code: https://github.com/Mireli5656/NetPulse

The beta is signed with a debug key, so uninstall any earlier NetPulse build before installing it.

Thanks for trying it!

— u/TurboX5656
Источник: reddit.com ↗
r/Kotlin
Free Subscription For Kotlin Learning site

Ссылка: https://andrewaboalhana.github.io/kotlinGym/#/t/f-fun

— u/AndrewAboAlhana517
Источник: reddit.com ↗
r/Kotlin
Kotlin outside of android development.

So I have used typescript and now would like to try out some mobile development. How is support for web, desktop and iOS apps with Kotlin language. I have heard that the support is good but would you recommend using the language outside of android development or stick with Android development only and use typescript for web?

— u/Warm-Rabbit648
Источник: reddit.com ↗
r/Kotlin
I launched my first app on Play Store / Need advice

Hello guys. Finally after a closed beta process like hell, I launched my first App to the Play Store.

Actually, I learn't Kotlin and Compose last year and some hard school things occur after that, so I can't have time to Kotlin / Compose. Therefore, I decided to create my own real app to validate myself. I did.

I used V0 Dev to make my visual dreams to something I can't see.

It created the visual scaffold and I created my app, writed the Compose functions while looking and basing on it. At the final, it really differs from the V0 Dev's scaffold but at least, there is a nice functionally and minimallist UI there. So I'm really happy with what I did.

My app uses Open Food Facts API to search food on globally and scan barcode. It runs mostly time perfectly, some times Open Food Facts servers are busy but most of time it's good.

So, any advices? How you rate my app? Any senior Android Developer here, please give me advice so I can ecnhance my skill. Thanks a lot.

Ссылка: https://play.google.com/store/apps/details?id=com.esatdev.foodlog

— u/Esatttt
Источник: reddit.com ↗
r/Kotlin
Testing web server implementations for Kotlin

So - coming from C# - we were wondering about the performance of web server frameworks in Java and Kotlin as they are measured by HTTP Arena (https://http-arena.com/#sort=rps:-1&tuned=0), as there are pretty fast engines for that ecosystem, such as netty.

To see how fast we can get on the JVM we did two projects:

- ktron (https://github.com/MDA2AV/Ktron), a simple framework based on the ioxide runtime (https://github.com/MDA2AV/ioxide) (io_uring), with the goal of pushing the limits of what is possible with the JVM
- genhttp-kt (https://genhttp.org/kotlin), a functional port of the GenHTTP webserver for C# with high level functionality such as Open API, JWT etc. ... with GenHTTP being used by some projects and companies in production workloads

We were quite happy to see that both projects turned out pretty fast, with ktron currently leading the board, faster than any Rust or Go implementation, and genhttp-kt-netty ranked #12.

Note that both projects are experimental, so we are happy to get feedback on whether such projects would be useful for the Kotlin/Java ecosystem in general.

— u/Ok_Tour_8029
Testing web server implementations for Kotlin

So - coming from C# - we were wondering about the performance of web servИсточник: reddit.com ↗
r/Kotlin
Standalone CLI agents vs an IDE integrated AI coding agent for Kotlin on a large legacy codebase (Claude Code, Cursor, Codex, and Junie /ide) comparison

when i run a terminal AI coding agent on a self-contained service or a greenfield script, ripgrep plus a big context window is usually enough to get a clean patch. i wanted to share a comparison sheet i put together for our backend team while we were evaluating an AI coding agent for large codebases, specifically comparing standalone terminal/editor setups against an IDE integrated AI coding agent using the public benchmark numbers and current documentation for Claude Code, Cursor, OpenAI Codex, and JetBrains Junie.

even on the public 105-task Kotlin benchmark across real issues from ktlint, detekt, ort, and okhttp (where the agents ran inside isolated Docker containers with only bash tools and no IDE connected), pure CLI agents did great. those benchmark runs used an earlier model generation (Opus 4.7 and GPT-5.5), and Claude Code (Opus 4.7) took first place solving 90 / 105 tasks (10.59M avg tokens, ~118K per task), while JetBrains Junie (Opus 4.7) and OpenAI Codex (GPT-5.5) tied at 86 / 105 (Junie used 19.98M tokens vs Codex's 38.78M for the same solve count; Cursor wasn't included in that 105-task run).

where that headless container setup stops matching my day-to-day experience is when you need an AI coding agent for legacy code on a 10-year-old multi-module Java, Kotlin, and SQL repository. if you are looking for an AI coding agent for Java developers or an AI coding agent for Kotlin on an older monolith, a NullPointerException in OrderProcessor is usually caused by a constructor-injected bean in a Spring Configuration class three modules away that only returns null under a specific profile, or a method name that is overloaded 14 times across different packages. if an AI agent for debugging code only has text search or chunked vector embeddings, it spends 10 minutes grepping the file tree, misses an overload in a test fixture, or spams temporary println logs across eight files while acting as an AI coding agent that runs tests in a loop to figure out why a build failed.

here is the side-by-side sheet i made of how Claude Code, Cursor, OpenAI Codex, and Junie (specifically when Junie CLI is connected to a running IDE via /ide or run via the IDE plugin) handle context, refactoring, debugging, and database schemas on a large legacy codebase:

Workflow Dimension on Large / Legacy Repos Claude Code (CLI + LSP Plugins) Cursor (Standalone Editor + CLI / ACP) OpenAI Codex (CLI + codex exec) JetBrains Junie (IDE Plugin or CLI /ide Bridge)

Headless Container Baseline (105-Task Kotlin Eval) 90 / 105 solved (85.71%) · 10.59M avg tokens (Opus 4.7 xhigh — #1 solve rate & token efficiency) Not included in the 105-task Kotlin Benchmark run 86 / 105 solved (81.90%) · 38.78M avg tokens (GPT-5.5 xHigh — tied #2 solve rate) 86 / 105 solved (81.90%) · 19.98M avg tokens (Opus 4.7 max — tied #2 solve rate, ~1/2 of Codex's tokens)

How It Resolves Symbols & Call Graphs Connects to language server (LSP) plugins for definitions, references, and post-edit type errors; falls back to file search Queries an automatic semantic embeddings index + fast literal text search (or runs a subset inside JetBrains IDEs via ACP) Reads files and greps on demand through shell tools; relies on compiler/test runs to catch broken references Passively tracks open files/recent edits and queries the running IDE's AST symbol index (Find Usages, inheritance hierarchy, at-mention class/symbol completion) on demand via /ide

Multi-File Refactoring Generates coordinated text edits across files and checks types via LSP Generates multi-file diffs from semantic/text search results; verification relies on your test suite and diff review Generates text edits across files and validates by running the build Calls the IDE's native refactoring engine (resolving overloaded methods and scope through the compiler's project model) an
Источник: reddit.com ↗