Posts

The Silent Killers: How to Debug Android App Exits You Never Knew Happened

Image
Stop relying on Crashlytics alone. Learn how to use ApplicationExitInfo to track LMKs, silent ANRs, and native process kills.   Every Android developer has been there: you look at your Google Play Console, and the crash rate looks “clean.” But then you check your reviews, and users are complaining that the app “just closes” or “restarts randomly.” The truth is, many app terminations happen in the shadows. Whether it’s a system-level process kill due to low memory or a user force-stopping the app, these events often bypass traditional crash reporters like Firebase Crashlytics. Thankfully, since Android 11, we have a specialized diagnostic tool:  ApplicationExitInfo . Why Standard Crash Reporting Leaves You Blind Most crash SDKs rely on  Thread.setDefaultUncaughtExceptionHandler . This works for JVM-level fatal exceptions, but it is effectively blind when: The OS kills your process  to reclaim RAM (Low Memory Killer). The User force-closes  the app from System Set...

Mastering Kotlin Nullability: From Manual Casts to Power-User Contracts

Image
 Stop fighting the compiler. Move from risky casts to idiomatic Smart Casts and powerful (experimental) Kotlin Contracts. Null safety is the backbone of Kotlin, but there is a massive gap between writing code that “just works” and writing code that is truly  idiomatic . The Mental Model Kotlin null safety is a continuous conversation between you and the compiler: as  says: "Trust me, I know what I'm doing." Smart Casts  say: “Here is the proof you need.” Contracts  say: “Here is a legally binding promise.” Level 1: The Manual Cast (The “Trust Me” Operator) When moving from Java, the explicit casting operator  as  feels like home. However, in Kotlin,  as  is a "brute force" tool that bypasses the compiler's protection. fun printLengthManual (input: Any ?) { // DANGER: If input is null -> NullPointerException // DANGER: If input is an Int -> ClassCastException val message = input as String println( "Length is: ${messa...