---
title: "ANR and App Hangs"
description: "Configure Android ANR and Apple App Hang detection from shared Kotlin Multiplatform code."
url: https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs/
---

# ANR and App Hangs | Sentry for Kotlin Multiplatform

Sentry reports when your app's main thread becomes unresponsive so you can investigate the code that blocked it. The KMP SDK uses the native Android and Apple SDKs to detect these events.

## [Supported Platforms](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs.md#supported-platforms)

Use KMP SDK **0.5.0 or later** to configure detection through shared options:

* **Android**: Application Not Responding (ANR) events.
* **iOS, macOS, and tvOS**: App Hang events.

## [Configure Detection](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs.md#configure-detection)

Both detection options are enabled by default. To disable either feature, add the corresponding option to your shared initializer:

```kotlin
import io.sentry.kotlin.multiplatform.Sentry

fun initializeSentry() {
    Sentry.init { options ->
        options.dsn = "https://<key>@o<orgId>.ingest.sentry.io/<projectId>"
        options.isAnrEnabled = false // Android
        options.enableAppHangTracking = false // Apple
    }
}
```

### [Android ANR Timeout](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs.md#android-anr-timeout)

The `anrTimeoutIntervalMillis` option controls the watchdog detector's timeout in milliseconds. Its default is `5000` (five seconds). Set it in your initializer to change how long the main thread can remain blocked before that detector reports an ANR.

On Android 11 and newer, the native SDK uses the operating system's `ApplicationExitInfo` records. Changing `anrTimeoutIntervalMillis` does not change the operating system's ANR threshold. See the [Android ANR guide](https://docs.sentry.io/platforms/android/configuration/app-not-respond.md) for detection behavior and reporting differences.

### [Apple App Hang Timeout](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs.md#apple-app-hang-timeout)

##### Timeout Units

In KMP SDK versions 0.5.0 through 0.27.0, `appHangTimeoutIntervalMillis` is passed to Cocoa as seconds without conversion. The shared default of `2000` therefore becomes 2000 seconds, rather than two seconds. To set a timeout in these versions, use [native platform options](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/initialization-strategies.md#native-platform-options) and configure Cocoa's `appHangTimeoutInterval` in seconds.

See the [Apple App Hangs guide](https://docs.sentry.io/platforms/apple/configuration/app-hangs.md) for configuration, limitations, and guidance on using MetricKit for system-provided hang diagnostics.

## [Readable Stack Traces](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/configuration/anr-app-hangs.md#readable-stack-traces)

Upload the relevant debug files so Sentry can display readable stack traces for ANR and App Hang events. Follow the [Debug Symbols guide](https://docs.sentry.io/platforms/kotlin/guides/kotlin-multiplatform/debug-symbols.md) for Android mapping files and Apple debug symbols.
