# ProAndroidDev - Medium

The latest posts from Android Professionals and Google Developer Experts. - Medium

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Kotlin 2.4.20 Collection Checks and Experimental Context-Sensitive Resolution

DevFeed: [Kotlin 2.4.20 Collection Checks and Experimental Context-Sensitive Resolution](<https://devfeed.tech/articles/features-you-waited-for-so-long-in-kotlin-22944.md>)

Original publisher: [Read original article](<https://proandroiddev.com/features-you-waited-for-so-long-in-kotlin-6c822e9e344a?source=rss----c72404660798---4>)

Author: Andrii Dubovyk

Published: 2026-09-14T06:32:51Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [collections](<https://devfeed.tech/tags/collections.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [features](<https://devfeed.tech/tags/features.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [list](<https://devfeed.tech/tags/list.md>), [mobile-app-development](<https://devfeed.tech/tags/mobile-app-development.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [technology](<https://devfeed.tech/tags/technology.md>)

### AI overview

The article explains two Kotlin features: allDistinctBy and allEqualBy in Kotlin 2.4.20 for checking collection values, and experimental context-sensitive resolution introduced in Kotlin 2.2 to reduce repetition when the expected type is known.

### Source excerpt

Kotlin 2.4.20 gives your collections opinions, and 2.2's compiler finally learns to read the room Some Kotlin features get a lot of attention when they arrive. Others are much less noticeable, but still make everyday code a little easier to write. Two examples of the latter are allDistinctBy/ allEqualBy in Kotlin 2.4.20 and context-sensitive resolution, which was introduced experimentally in Kotlin 2.2. allDistinctBy/ allEqualBy: A Simpler Way to Check Collections For years, checking whether all values in a collection were unique often looked something like this: val users = listOf( User(name = "A", age = 20), User(name = "B", age = 25), User(name = "C", age = 30) ) users.map { it.age }.distinct().size == users.size // true It works, but it creates another list, removes duplicates, counts the result, and then compares the sizes just to get a Boolean answer. Kotlin 2.4.20 adds a more direct way to express the same check: users.allDistinctBy { it.age } // true users.allEqualBy { it.age } // false allDistinctBy returns false as soon as it finds a duplicate, so it doesn't need to process the entire collection or create a separate Set. allEqualBy does the opposite: it checks whether all elements produce the same value when passed through the selector. Both functions work with Iterable, Sequence, and arrays. They use structural equality. For floating-point values, they follow Double.equals semantics, so NaN is considered equal to NaN, while -0.0 is different from 0.0. They're still @ExperimentalStdlibApi, so you'll need to opt in before using them in production code. The underlying allDistinct() and allEqual() requests have also been around in YouTrack for quite a while, which makes their appearance in the standard library feel long overdue. Context-Sensitive Resolution: Less Repetition in when The second feature is more about syntax. When the compiler already knows the type you're working with, you can sometimes leave out the type qualifier. Before: enum class Problem {

## On-Device AI Series (Part 5): LiteRT-LM

DevFeed: [On-Device AI Series (Part 5): LiteRT-LM](<https://devfeed.tech/articles/on-device-ai-series-part-5-litert-lm-22949.md>)

Original publisher: [Read original article](<https://proandroiddev.com/on-device-ai-series-part-5-litert-lm-d6c23b102094?source=rss----c72404660798---4>)

Author: Oğuzhan Aslan

Published: 2026-09-14T05:59:12Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [LiteRT](<https://devfeed.tech/topics/litert.md>), [On-device AI](<https://devfeed.tech/topics/on-device-ai.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Inference](<https://devfeed.tech/topics/inference.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>), [GPU](<https://devfeed.tech/topics/gpu.md>), [LLM evaluation / benchmarking](<https://devfeed.tech/topics/llm-evaluation-benchmarking.md>), [PyTorch](<https://devfeed.tech/topics/pytorch.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [inference](<https://devfeed.tech/tags/inference.md>), [litert](<https://devfeed.tech/tags/litert.md>), [llama](<https://devfeed.tech/tags/llama.md>), [llm](<https://devfeed.tech/tags/llm.md>), [multimodal](<https://devfeed.tech/tags/multimodal.md>), [on-device](<https://devfeed.tech/tags/on-device.md>), [on-device-ai](<https://devfeed.tech/tags/on-device-ai.md>), [programming](<https://devfeed.tech/tags/programming.md>), [pytorch](<https://devfeed.tech/tags/pytorch.md>), [qwen](<https://devfeed.tech/tags/qwen.md>), [software-development](<https://devfeed.tech/tags/software-development.md>), [streaming](<https://devfeed.tech/tags/streaming.md>)

### AI overview

This tutorial explains LiteRT-LM for running large language models on-device. It covers the Engine/Session API, streaming output, system prompts, tool calling, multimodal inputs, thinking mode, and CPU-versus-GPU benchmarking. The article also discusses tradeoffs involving privacy, network independence, latency, memory, sampling configuration, and model capability compared with cloud APIs.

### Source excerpt

Put your phone in airplane mode. Open the app, type a question, and watch the answer arrive one token at a time -- no spinner waiting on a network round-trip, no API key, no per-token bill, and nothing you typed ever leaving the device. LiteRT-LM removes the genuinely hard parts of running an LLM on-device -- KV-cache management, token streaming, backend selection -- but it doesn't remove your job so much as relocate it. What's left on your plate is a short, specific list: sizing a combined input+output token budget, owning your own sampling defaults, hand-building system prompts and tool calling out of raw text, and one native-library collision that presents as a SIGSEGV rather than a build error. Know those going in and the API itself is a clean three-step pattern. We'll get there in that order: Why you'd choose this runtime and what it costs you versus the cloud. The Engine/Session model you need to read the code at all. Real implementation samples -- streaming, system prompts and tool calling, multimodal inputs, thinking mode, and CPU-vs-GPU benchmarking. The anti-patterns to avoid. A developer-friendliness rating on the same rubric as Parts 1-4. Why Use LiteRT-LM? You reach for LiteRT-LM instead of hand-rolling generation on top of raw LiteRT when: You need multi-turn conversation, not single-shot inference -- session state and KV-cache bookkeeping are handled for you, and resetting a conversation is a session swap, not a model reload. You need streaming output -- token-by-token delivery for a responsive chat UI, instead of a blocking call that returns everything at once. You're choosing between CPU and GPU per device -- the explicit backend parameter turns that into a runtime decision instead of a build-time guess. You want a pre-converted model without doing your own PyTorch-to-LiteRT conversion work -- the Model Zoo covers Gemma, Qwen, Llama, and more out of the box. You're willing to own sampling -- the engine won't pick sane decoding defaults for you; that's on the

## Koko, KMP Starter Kit -- Part 3: Publishing: Your App in the Stores

DevFeed: [Koko, KMP Starter Kit -- Part 3: Publishing: Your App in the Stores](<https://devfeed.tech/articles/koko-kmp-starter-kit-part-3-publishing-your-app-in-the-stores-22948.md>)

Original publisher: [Read original article](<https://proandroiddev.com/kmp-starter-kit-part-3-publishing-your-app-in-the-stores-fd64d3629c02?source=rss----c72404660798---4>)

Author: Mirzamehdi Karimov

Published: 2026-09-14T04:48:22Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [Script](<https://devfeed.tech/topics/script.md>), [Development](<https://devfeed.tech/topics/development.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [GitHub](<https://devfeed.tech/topics/github.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [compose-multiplatform](<https://devfeed.tech/tags/compose-multiplatform.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [development](<https://devfeed.tech/tags/development.md>), [github](<https://devfeed.tech/tags/github.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [script](<https://devfeed.tech/tags/script.md>)

### AI overview

This tutorial explains the publishing phase of the KMP Starter Kit, covering store accounts, app identifiers, configuration checks, privacy and terms URLs, support email, and publishing both apps from GitHub without a Mac. It also describes Google Play's closed-testing requirement for individual accounts.

### Source excerpt

Part 3 of 4: the third phase of the KMP contest starter kit. What to check when publishing, what the stores ask for, and how to publish both apps from GitHub without having a Mac. New here? Part 1 introduces the kit and gets your app running on your machine. Part 2 connects it to Firebase, sign in and a backend. You've finished the development part of your app, tested it, and it works. Screens done, data saved, maybe some services connected from part 2. Now comes the publishing part, and it can look complicated at first. But publishing is mostly a checklist, and the kit ships the checklist as a script: ./MobileApp/scripts/check_env.sh --phase publishing Or ask your AI coding assistant "is my app ready to publish?" and it runs this instead of guessing. It checks the things people forget: are the privacy policy and terms URLs real pages instead of placeholders? Is the contact email still support@example.com? Is your AI feature still calling providers directly with a key that would ship inside the binary? Each warning points at the fix. The rest of this post goes through the phase in order. A few steps involve waiting, so it's better to read it once first and start those early. Store accounts You need a developer account with each store. Google Play: $25, once. Apple: $99 per year. Start both today. Apple or Google can take days to verify a new account. Google Play has a testing rule: if you register as an individual (not a company), you can't publish to production until your app has run a closed test with at least 12 testers for 14 days, and then you apply for production access. Company accounts skip this, but need a registered business with a D-U-N-S number. For most first apps: register as an individual, collect 12 friends' emails now, and use those two weeks as your beta. App id and configuration Two things become permanent in this phase. The app id. Google Play ties your package name to the app on the first upload, and Apple ties the bundle id to the store record.

## Build Setup: Targets, Source Sets and buildSrc for tvOS in a Compose Multiplatform Fork

DevFeed: [Build Setup: Targets, Source Sets and buildSrc for tvOS in a Compose Multiplatform Fork](<https://devfeed.tech/articles/build-setup-targets-source-sets-and-buildsrc-for-tvos-in-a-compose-multiplatform-fork-22943.md>)

Original publisher: [Read original article](<https://proandroiddev.com/build-setup-targets-source-sets-and-buildsrc-for-tvos-in-a-compose-multiplatform-fork-4d9caafa30a8?source=rss----c72404660798---4>)

Author: Sajid Ali

Published: 2026-09-14T04:24:43Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [compose-multiplatform](<https://devfeed.tech/topics/compose-multiplatform.md>), [tvOS](<https://devfeed.tech/topics/tvos.md>), [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [build](<https://devfeed.tech/tags/build.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compose-multiplatform](<https://devfeed.tech/tags/compose-multiplatform.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [gradle-plugin](<https://devfeed.tech/tags/gradle-plugin.md>), [ios](<https://devfeed.tech/tags/ios.md>), [jetbrains](<https://devfeed.tech/tags/jetbrains.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [source](<https://devfeed.tech/tags/source.md>)

### AI overview

This tutorial explains the build setup for adding tvOS support to a Compose Multiplatform fork. It covers Kotlin Multiplatform targets, source-set organization shared between iOS and tvOS, and the build-layer work used to identify missing modules and dependencies.

### Source excerpt

Compose Multiplatform on tvOS This series: Compose Multiplatform on tvOS My Journey Making Compose Multiplatform Work on tvOS, and What I Learned Build Setup: Targets, Source Sets and buildSrc for tvOS in a Compose Multiplatform Fork (this post) Rendering (coming soon) Siri Remote input (coming soon) Siri Remote trackpad (coming soon) Screen density and text input (coming soon) Porting tv-material (coming soon) The Gradle plugin and third-party libraries (coming soon) Maintaining the fork (coming soon) Building a real app on it (coming soon) Part 1 was why this fork exists. This one is the build layer, and it comes before any Compose code, because in Kotlin Multiplatform a target is not a flag you flip at the end. It decides which source sets compile, which dependencies resolve, which klibs get published, which linker flags get passed. Until the build knows about tvosArm64, nothing tells you what is missing. So the first commits were build files. Once the targets were on, the compiler listed what was missing, module by module, and I worked through that list. Source set layout on the tvos branch I started on a branch called tvos, based on upstream. Back then JetBrains called iOS "uikit" in this repository and the source set was uikitMain. Because tvOS is also UIKit underneath, it made sense to have a common source parent for both iOS and tvOS. But iOS was already being called uikit, so I chose uiKitCommonMain as the source set name and moved all the UIKit files there, keeping only the iOS specific files in uikitMain and putting the tvOS specific files in a new source set, tvosMain. The problem with this approach was how to keep up with upstream. I tried a symlink to the uikit source set, and then overriding the tvOS files in a separate target. The override worked but complicated the process. At that time my goal was to make it runnable on tvOS however possible, so we would have a proof of concept. So I did a lot of hacks in the tvos branch to make it runnable, and af

## The Thumb That Ran Ahead of the Finger: Anatomy of a Compose Slider Bug

DevFeed: [The Thumb That Ran Ahead of the Finger: Anatomy of a Compose Slider Bug](<https://devfeed.tech/articles/the-thumb-that-ran-ahead-of-the-finger-anatomy-of-a-compose-slider-bug-22952.md>)

Original publisher: [Read original article](<https://proandroiddev.com/the-thumb-that-ran-ahead-of-the-finger-anatomy-of-a-compose-slider-bug-ddec306251d0?source=rss----c72404660798---4>)

Author: Vitaliy Gribko

Published: 2026-09-14T04:19:34Z

Content type: article

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [bug](<https://devfeed.tech/topics/bug.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [Design system](<https://devfeed.tech/topics/design-system.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bug](<https://devfeed.tech/tags/bug.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [design-system](<https://devfeed.tech/tags/design-system.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [qa](<https://devfeed.tech/tags/qa.md>), [race-condition](<https://devfeed.tech/tags/race-condition.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This article examines a deterministic bug in a custom Compose slider where the thumb moves ahead of the user's finger during a drag. It traces the issue to a design-system slider forked from the AOSP Material implementation and discusses debugging and code simplification.

### Source excerpt

A bug report sat in the backlog for seven months. The fix took a day, deleted a third of the slider's logic, and was almost shipped with a second bug inside -- until a machine read my diff better than I did. This is the whole story: the ported behavior that never made sense, the race nobody reported, and why the best fixes remove code. The report The bug report was seven months old when it reached me. A QA engineer had filed it in December, with a screen recording and three steps: Open the people search filters. Grab the right-hand thumb of the age range slider. Drag it slowly to the left. The recording showed the problem in two seconds. The thumb does not follow the finger. It sprints ahead -- you are still crossing the gap between two ticks, and the thumb is already standing on the next one, waiting for you, like a dog that runs to the park while you are still tying your shoes. Expected: the thumb moves with the finger. Actual: it escapes. On a budget phone, on two Android versions, every time. Not a race condition, not a flake -- a perfectly deterministic lie, filmed in December, assigned to a fix-day in July. Seven months is not negligence. It is the natural half-life of a visual glitch filed as minor against a screen nobody dies on. The age filter works. You tap a tick, the value applies. Only the drag -- the one gesture the slider exists for -- feels wrong in a way that is hard to screenshot and easy to deprioritize. When the ticket finally landed on my desk, a colleague glanced at it and asked whether it had already been fixed once. It had not. But I understood his confusion later, when I opened the slider's source and found a comment that explained everything -- including why this bug felt so old. The comment that confessed The slider is not the framework's slider. Our design system ships its own Compose slider, forked from the AOSP Material one, because design needed three knobs the framework does not expose: a custom thumb radius, a custom track height, a differ

## How Kotlin Flow Operator Fusion Works and When Ordinary Operators Break It

DevFeed: [How Kotlin Flow Operator Fusion Works and When Ordinary Operators Break It](<https://devfeed.tech/articles/i-counted-every-hidden-channel-kotlin-flow-creates-most-devs-are-wrong-about-which-operators-are-22947.md>)

Original publisher: [Read original article](<https://proandroiddev.com/i-counted-every-hidden-channel-kotlin-flow-creates-most-devs-are-wrong-about-which-operators-are-8f38cf676e07?source=rss----c72404660798---4>)

Author: Majidshahbaz

Published: 2026-09-13T05:43:21Z

Content type: article

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [code](<https://devfeed.tech/tags/code.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>)

### AI overview

This article investigates Kotlin Flow operator fusion by instrumenting the runtime and comparing pipelines with adjacent fusible operators against pipelines interrupted by an ordinary map() call. It explains that adjacent channelFlow, flowOn, buffer, and produceIn calls can share one underlying channel through FusibleFlow, while an intervening non-fusible operator causes additional wrapper structure.

### Source excerpt

Image Generated for the ArticleI Counted Every Hidden Channel Kotlin Flow Creates -- Most Devs Are Wrong About Which Operators Are Freebuffer() and flowOn() are supposed to fuse into one channel when chained. I wrote code to prove it -- and then found four "harmless" operators that quietly break it. Ask any experienced Kotlin developer what happens when you chain .buffer().flowOn(Dispatchers.IO).buffer(), and you'll usually get a confident answer: "it fuses into one channel." That's the folklore, repeated in talks, docs, and Stack Overflow answers. It's also only half true, and nobody seems to have actually checked the other half: which everyday operators quietly stop that fusion from happening. I decided to stop trusting folklore and instrument the actual runtime. Five separate experiments later, I had a very clear, very measurable answer -- and one of the results genuinely surprised me. The Myth, and the Mechanism Behind It Kotlin's coroutines library really does fuse adjacent channelFlow, flowOn, buffer, and produceIn calls into a single underlying channel instead of creating one per operator. This isn't a rumor -- it's real, deliberate behavior, implemented through an interface called FusibleFlow. Here's the actual check, straight from the source: https://medium.com/media/1cd3b407c1f2b2955b3df4be68ca18b5/href When flowOn() or buffer() is called, it checks whether the flow it's being called on already implements FusibleFlow. If it does, instead of wrapping it in a new object, it calls .fuse() -- which updates the existing object's settings (buffer size, dispatcher) in place. No new object. No new coroutine. No new channel. But that check only succeeds if the upstream is already a ChannelFlow. And that's where the folklore quietly stops being true. Building Something to Actually Measure This I wrote two nearly identical pipelines -- one where the fusible operators sit directly next to each other, and one where a completely ordinary map() sits in the middle: https://medi

## Kotlin Explicit Backing Fields: Encapsulation Tradeoffs and Downcasting Risks

DevFeed: [Kotlin Explicit Backing Fields: Encapsulation Tradeoffs and Downcasting Risks](<https://devfeed.tech/articles/the-downcast-trap-in-kotlin-s-explicit-backing-fields-22951.md>)

Original publisher: [Read original article](<https://proandroiddev.com/the-downcast-trap-in-kotlins-explicit-backing-fields-626ef0d66e50?source=rss----c72404660798---4>)

Author: Ehab Elwan

Published: 2026-09-13T05:31:32Z

Content type: opinion

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [article](<https://devfeed.tech/tags/article.md>), [clean-code](<https://devfeed.tech/tags/clean-code.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [memory](<https://devfeed.tech/tags/memory.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>)

### AI overview

This article compares Kotlin's traditional private mutable property plus public read-only wrapper with explicit backing fields. It explains that explicit backing fields can avoid an extra wrapper allocation, but because the underlying object remains mutable, an external downcast may bypass the intended read-only restriction and mutate internal state.

### Source excerpt

Why eliminating the double-property boilerplate changes how we protect our architecture Image generated by AIDisclosure: This article was drafted by me and refined with the help of AI tools. If you have written Kotlin in the last few years, you are intimately familiar with the double-property boilerplate. Whether in Android ViewModels or general state holders, maintaining a private mutable property alongside a public read-only property is a chore we have all accepted in the name of strict encapsulation to prevent our internal state from being hijacked by outside classes. It makes the code significantly cleaner (and slightly more memory efficient). However, it fundamentally changes how we protect our state, moving from a physical object boundary to a simple type restriction. Let's look at the tradeoff. The Old Way: Wrapper Protection For years, the standard approach to encapsulating state has looked like this: class OldViewModel { // 1. The private mutable state private val _uiState = MutableStateFlow(UiState()) // 2. The public read-only state val uiState: StateFlow<UiState> = _uiState.asStateFlow() } This is tedious to write, but it provides a strict architectural guarantee. When you call .asStateFlow(), Kotlin does not just change the type; it creates a brand new wrapper object in memory (ReadonlyStateFlow). While this physical barrier is fantastic for safety, it does mean you are incurring a minor memory allocation overhead by creating a secondary wrapper object for every exposed state. The New Way: Upcasting Explicit Backing Fields allow you to merge these two properties into one concise declaration, bypassing that extra memory allocation entirely: class NewViewModel { val uiState: StateFlow<UiState> field = MutableStateFlow(UiState()) } Inside your class, the Kotlin compiler smart-casts the field so you can mutate it internally. Outside the class, the compiler restricts callers to the read-only StateFlow interface. It looks incredibly clean and saves an allocat

## The Android Startup Pattern: A Lifecycle-Aware, Multi-Module Approach

DevFeed: [The Android Startup Pattern: A Lifecycle-Aware, Multi-Module Approach](<https://devfeed.tech/articles/the-android-startup-pattern-a-lifecycle-aware-multi-module-approach-22950.md>)

Original publisher: [Read original article](<https://proandroiddev.com/the-android-startup-pattern-a-lifecycle-aware-multi-module-approach-d0f73e367a62?source=rss----c72404660798---4>)

Author: Ehab Elwan

Published: 2026-09-13T05:31:09Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [modules](<https://devfeed.tech/topics/modules.md>), [Jetpack](<https://devfeed.tech/topics/jetpack.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [app-startup](<https://devfeed.tech/tags/app-startup.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [framework](<https://devfeed.tech/tags/framework.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [mobile-architecture](<https://devfeed.tech/tags/mobile-architecture.md>), [module](<https://devfeed.tech/tags/module.md>), [privacy](<https://devfeed.tech/tags/privacy.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>)

### AI overview

This tutorial presents a lifecycle-aware, dependency-injection-driven startup pattern for modular Android applications. It contrasts a centralized startup anti-pattern with Jetpack App Startup and discusses process lifecycles, testability, and delaying tracking SDK initialization until privacy consent is evaluated.

### Source excerpt

A Clean, DI-Driven Architecture for Managing Cold Starts, Background Wakeups, and Privacy Compliance in Modern Android Apps Image generated by AIDisclosure: This article was drafted by me and refined with the help of AI tools. Every growing Android project eventually spawns a two-headed "God Class." On one side, your Application class becomes a dumping ground for global infrastructure--third-party SDKs, crash reporters, and tracking tools. On the other side, your main entry point (typically the MainViewModel) gets choked with UI-blocking startup logic. It usually looks something like this: The Anti-Pattern: The Two-Headed God Class class MyApplication : Application() { override fun onCreate() { super.onCreate() // The framework dumping ground CrashReportingSDK.getInstance().setCollectionEnabled(true) HeavyUiSDK.initialize(context = this, ...) AnalyticsSDK.initialize(this, "API_KEY") // ... 50 more lines of spaghetti } }class MainViewModel : ViewModel() { init { // The UI-blocking dumping ground updateRemoteConfigs() checkUserSessionToken() processPendingDeepLinks() prefetchHomeFeedData() // ... UI cannot render until this finishes } } Splitting initialization across these two files creates major problems: It breaks the Single Responsibility Principle: The app's entry points are forced to orchestrate the inner workings of every single feature, tightly coupling your modules. It ignores process lifecycles: Application tasks run indiscriminately on every silent background wakeup, while MainViewModel tasks fail to re-trigger when the app returns to the foreground. It destroys testability: Hardcoding SDK initializations directly into your entry points makes it incredibly difficult to write isolated unit tests without complicated mocking setups. It complicates privacy compliance: A centralized dumping ground makes it extremely difficult to dynamically suspend tracking SDKs until user consent under global privacy regulations (such as GDPR, CCPA, and CPRA) is explicitly grant

## A Multi-Module Android Template with Kotlin Convention Plugins, Lint Rules, and Design System Tokens

DevFeed: [A Multi-Module Android Template with Kotlin Convention Plugins, Lint Rules, and Design System Tokens](<https://devfeed.tech/articles/forget-the-setup-tax-a-production-ready-multi-module-android-template-22945.md>)

Original publisher: [Read original article](<https://proandroiddev.com/forget-the-setup-tax-a-production-ready-multi-module-android-template-f4c879c97205?source=rss----c72404660798---4>)

Author: Shamil Gulmetov

Published: 2026-09-09T01:34:18Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Template](<https://devfeed.tech/topics/template.md>), [Android](<https://devfeed.tech/topics/android.md>), [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [Automation](<https://devfeed.tech/topics/automation.md>), [Refactoring](<https://devfeed.tech/topics/refactoring.md>), [now-in-android](<https://devfeed.tech/topics/now-in-android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-architecture](<https://devfeed.tech/tags/android-architecture.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [automation](<https://devfeed.tech/tags/automation.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [build](<https://devfeed.tech/tags/build.md>), [compose](<https://devfeed.tech/tags/compose.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [now-in-android](<https://devfeed.tech/tags/now-in-android.md>), [refactoring](<https://devfeed.tech/tags/refactoring.md>)

### AI overview

This tutorial presents an Android Architecture Template based on patterns from Google's Now in Android repository. It describes a multi-module structure with Gradle Version Catalogs, Kotlin Convention Plugins, Jetpack Compose design tokens and dark-theme support, dependency injection, custom Lint rules, and a terminal-based renaming tool.

### Source excerpt

How to streamline your development workflow with pre-configured Kotlin Convention Plugins, custom Lint rules, and unified design system tokens. Creating a new Android application from scratch in modern engineering is rarely as simple as clicking File -> New -> New Project in Android Studio. Before writing a single line of business logic, developers face hours -- or even days -- of repetitive infrastructure setup: Configuring a scalable multi-module architecture. Setting up Gradle Version Catalogs and writing custom Kotlin Convention Plugins to eliminate build script duplication. Standardizing design tokens and dark theme support in Jetpack Compose. Wiring up Hilt Dependency Injection for Coroutine Dispatchers, network, and Application Scopes. Enforcing architectural boundaries and team coding standards using custom static analysis (Lint) rules. Google's official Now in Android (NiA) repository is the recognized gold standard for modern Android engineering. However, because NiA is a full-featured showcase app with domain logic (news feeds, authors, bookmarks, offline sync), using it as a starter kit is cumbersome: developers must strip out existing features while risking breaking build pipelines. This Android Architecture Template bridges that gap: a clean, production-ready starter kit that extracts NiA's best architectural patterns into an isolated foundation. To make it enterprise-ready with zero room for error, it includes a standalone automation tool. Instead of manual refactoring, run a single terminal command to rename and brand the entire architecture in seconds. Acknowledgments & Credits Core architectural decisions, build-logic convention plugins, and static analysis infrastructure in this template are directly inspired by Google's official Now in Android (NiA) repository. Rather than reinventing the wheel, this template focuses on developer ergonomics--making Google's best practices instantly usable out of the box. 1. Modular Project Architecture The repository

## From Permissions to Sessions: Rethinking Location Access in Android 17

DevFeed: [From Permissions to Sessions: Rethinking Location Access in Android 17](<https://devfeed.tech/articles/from-permissions-to-sessions-rethinking-location-access-in-android-17-22946.md>)

Original publisher: [Read original article](<https://proandroiddev.com/from-permissions-to-sessions-rethinking-location-access-in-android-17-5a13124b777d?source=rss----c72404660798---4>)

Author: Nav Singh

Published: 2026-09-09T01:15:51Z

Content type: tutorial

Language: en

Sources: [ProAndroidDev - Medium](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [android-development](<https://devfeed.tech/topics/android-development.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [android-permissions](<https://devfeed.tech/tags/android-permissions.md>), [android17](<https://devfeed.tech/tags/android17.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [compose](<https://devfeed.tech/tags/compose.md>), [development](<https://devfeed.tech/tags/development.md>), [feature](<https://devfeed.tech/tags/feature.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [permission](<https://devfeed.tech/tags/permission.md>)

### AI overview

A tutorial on implementing Android 17's system-rendered Location Button in Jetpack Compose. The button uses the USE_LOCATION_BUTTON permission and grants precise location for the current session, with local rendering fallback on older Android versions or when remote rendering fails.

### Source excerpt

Image generated using Gemini In this article, we will learn how to implement the new 📍Location button introduced in Android 17 in Jetpack Compose-based Android applications. Android 17 adds a system-rendered 📍Location Button that we can drop into the layout via a Jetpack library, and tapping it gives the app precise location for that session only, gated by a new USE_LOCATION_BUTTON permission. What the feature is Android now exposes a system-owned, standard location button that we can embed in our UI instead of designing a custom control. When the user taps it, the system handles the permission flow, then grants the app precise location for the current session only, rather than long-lived access. How it changes permissions Instead of immediately requesting ACCESS_FINE_LOCATION (and maybe ACCESS_COARSE_LOCATION) at runtime, we declare the new USE_LOCATION_BUTTON permission to host the button. <!-- Standard Coarse and Fine Location Permissions + onlyForLocationButton --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:usesPermissionFlags="onlyForLocationButton"/> <!-- Required system permission for rendering the LocationButton --> <uses-permission android:name="android.permission.USE_LOCATION_BUTTON" />Developer benefits Less custom permission boilerplate: We lean on system UX and the Jetpack library for the hardest parts of location consent. [versions] locationbuttonCompose = "1.0.0-alpha01" [libraries] androidx-locationbutton-compose = { group = "androidx.core.locationbutton", name = "locationbutton-compose", version.ref = "locationbuttonCompose" } Higher trust and clarity for users: the control looks and behaves consistently across apps, and session-only precise access is easier to understand than broader access. Implementation As we all know, Android development is now Compose-first, so we will implement it using the LocationButton composable provided by th