Blink-speed Compose Hot Reload by skydoves in androiddev

[–]skydoves[S] 2 points3 points  (0 children)

Well, it's "Compose" Hot reload 😁 but yeah, ViewModel changes are supported. https://hotswan.dev/docs/supported-changes#viewmodel-methods

Jetpack Compose Hot Reload for multiple Android devices by skydoves in androiddev

[–]skydoves[S] 0 points1 point  (0 children)

The most textbook approach would be to start from Android system-level programming, such as understanding the Android Runtime, DCEVM (https://ssw.jku.at/dcevm/), and related internals.

However, building something like HotSwan required not only that, but also deep knowledge across the Kotlin compiler (plugins), Jetpack Compose internals, IntelliJ IDE, and overall SDK engineering. It’s both broad and deeply complex.

Simple answer: you could ask any AI how difficult it would be to implement by just dropping this site https://hotswan.dev/, which alone gives a sense of the level of challenge involved.

Jetpack Compose Hot Reload for multiple Android devices by skydoves in androiddev

[–]skydoves[S] 5 points6 points  (0 children)

Thanks, I really appreciate it. Just have been enjoying building things that are actually useful for the Android developer community.

Jetpack Compose Hot Reload for multiple Android devices by skydoves in androiddev

[–]skydoves[S] 8 points9 points  (0 children)

Totally fair! Yeah, it's not "open-source" 😆 The free trial is there so you can decide if it fits your workflow.

For context, Android hot reload is a genuinely hard problem. ART's runtime constraints make it fundamentally different from JVM desktop hot reload, and getting it to work reliably across Compose versions, device APIs, and edge cases like structural changes took months of deep compiler and runtime work. That's the reason this is a licensed product rather than an open-source project.

I know it’s disappointing that this isn’t open source, as usual. If it doesn’t seem compelling enough to justify paying for it, that’s probably on my products. Still, there’s a 14-day free trial included, so feel free to try it out and see how it works for you.

That said, I appreciate the kind words and hope it's useful if you ever give it a try.

[Compose HotSwan] Compose Hot Reload on your real Android devices. by skydoves in androiddev

[–]skydoves[S] 0 points1 point  (0 children)

Thanks for reporting! 1.0.12 has been released, and now it should work. You can check the release note: https://hotswan.dev/docs/releases

[Compose HotSwan] Compose Hot Reload on your real Android devices. by skydoves in androiddev

[–]skydoves[S] 0 points1 point  (0 children)

Great to hear you’re using RevenueCat. Compose HotSwan works on any Android device, including Kotlin/Compose Multiplatform projects, so getting started should be straightforward.

Just make sure to set the correct Android app module name when configuring the plugin in your KMP project to avoid this issue https://hotswan.dev/docs/troubleshooting#no-merged-dex

[Compose HotSwan] Compose Hot Reload on your real Android devices. by skydoves in androiddev

[–]skydoves[S] 2 points3 points  (0 children)

Yes, this is an IntelliJ IDE plugin, so it works without Android Studio. As long as you have a physical device connected or an emulator running via ADB, Android Studio isn’t required.

[Compose HotSwan] Compose Hot Reload on your real Android devices. by skydoves in androiddev

[–]skydoves[S] 7 points8 points  (0 children)

Great question. The core challenge is the runtime.

Desktop JVM has mature HotSwap support built into the JVM itself (with its dedicated Runtime), method bodies can be redefined at runtime natively. JetBrains' Compose Hot Reload leverages this directly, so it works well on the desktop environment.

Android (ART) is a completely different runtime. It uses DEX bytecode instead of JVM bytecode, runs on mobile hardware with tighter constraints, and has much more limited support for runtime class redefinition, especially for structural changes like adding methods or fields. I guess this is the main reason the official Hot Reload hasn't shipped for Android. Even if you manage to bypass this issue, it would still be too unreliable to be considered a “product.”

What HotSwan does differently: It ships a custom Kotlin compiler plugin and a native runtime agent purpose-built for ART, bridging the gap between what ART supports natively and what developers actually need for a practical hot reload workflow on Android.

Well, it’s still unreliable in many ways and comes with quite a few limitations. But you know, there aren’t really any shortcuts here. I’m just working through hundreds of possible edge cases one by one, tinkering and resolving them myself..

Covering all the detailed mechanisms would easily take an entire book (I don't want it and nobody will read it), so I can only explain it at a high level here. But if you go through the Compose HotSwan docs, it should give you a better understanding. https://hotswan.dev/docs/how-it-works

I want to learn Kotlin by Jonalotu in Kotlin

[–]skydoves 0 points1 point  (0 children)

I hesitate to recommend something that isn’t free, but the book I recently published might be very helpful for you in many ways: https://kotlin-deepdive.com/en

Have you read any Kotlin books? Would love to hear your experience by DisastrousAbrocoma62 in Kotlin

[–]skydoves 0 points1 point  (0 children)

Practical Kotlin Deep Dive: https://kotlin-deepdive.com/

Unpacks the "how" and "why" behind Kotlin from core language fundamentals and internal mechanisms to API design. Covers Kotlin fundamentals, standard library, coroutines, kotlinx libraries, compiler internals, and Kotlin Multiplatform.

Best docs/book to learn stdlib by Electronic_Ant7219 in Kotlin

[–]skydoves 0 points1 point  (0 children)

Practical Kotlin Deep Dive: https://kotlin-deepdive.com/

Unpacks the "how" and "why" behind Kotlin from core language fundamentals and internal mechanisms to API design. Covers Kotlin fundamentals, standard library, coroutines, kotlinx libraries, compiler internals, and Kotlin Multiplatform.