Fix ANR in Kotlin Multiplatform Apps (Android)

ANR (App Not Responding) in KMP apps
ANR, or Application Not Responding, happens when an Android app stops responding to user input for five seconds or more. The Android build of a Kotlin Multiplatform (KMP) app is a regular Android app, so it is subject to the same rule.
During an ANR the app appears frozen and Android shows a dialog offering to close the app or wait. Users often close the app, lose unsaved work and may not come back.
In KMP projects ANRs are easy to introduce without noticing: shared code is written once for both platforms, and a call that is cheap on one platform or in tests can block the Android main thread in production.
Why does this happen?
ANRs in KMP Android builds usually come from:
Blocking work on Dispatchers.Main: Shared repositories or use cases that run disk, database or parsing work on the main dispatcher instead of a background dispatcher.
runBlocking in shared code: Using runBlocking to bridge suspend functions into synchronous APIs blocks the calling thread, which is often the main thread.
Slow I/O and network calls: File access, SQL queries or synchronous network requests made from UI code or from shared code called by the UI.
Heavy app start-up and initialization: Initializing dependency injection, databases or SDKs synchronously in Application.onCreate() or the first screen.
Deadlocks and lock contention: Shared state protected by locks or mutexes that the main thread waits on while a background coroutine holds them.
How to fix it using Appxiom
- Analyze stack trace: The issue report provides the stack trace of the main thread and related threads, pointing to the line of code that blocked the UI.
- Trace activity trail: The activity trail shows the screens, network calls and events that happened before the ANR, so you can retrace what the user was doing.
- No extra code needed: ANRs are tracked automatically once
Ax.initis called on Android. See Crash & Error Reporting for KMP.
Stop guessing. Start fixing.
Get real-time alerts, exact stack traces, and complete activity trails before these issues impact your revenue.
Related Issues & Failure Guides
Fix Crashes in Kotlin Multiplatform Apps
Detect crashes from shared Kotlin code on Android and iOS, including uncaught coroutine exceptions and Kotlin/Native crashes, with full stack traces and trails.
Fix App Hangs in Kotlin Multiplatform Apps (iOS)
Detect main-thread hangs in the iOS build of KMP apps. Pinpoint blocking calls from Swift into shared Kotlin code and slow Compose Multiplatform rendering.
Fix High Memory Usage in Kotlin Multiplatform Apps
Monitor abnormal memory growth in KMP apps on Android and iOS. Find unbounded caches and long-lived scopes in shared code before out-of-memory crashes.
We use cookies to improve your experience.