---
updatedAt: 2026-05-27T21:56:35.000Z
---

# Log exceptions in a native Android app

The Connect library can capture exception data from your Android app and send it to the Connect collector.

# Automatic exception logging

The SDK automatically captures uncaught exceptions — crashes that terminate the app. When an uncaught exception occurs, the library records the stack trace and the state of the device and sends it to the Connect collector. No additional setup is required.

# Manual exception logging

For caught exceptions, call `Connect.logException()` in your `catch` block. This gives you the same stack trace and device information as an uncaught exception, without terminating the app.

## Basic example

Use the single-parameter overload for the simplest case:

```kotlin Kotlin
try {
    val array = IntArray(1)
    val i = array[2] // throws IndexOutOfBoundsException
} catch (e: Exception) {
    Connect.logException(e)
}
```

## With additional data

Pass a `HashMap` to attach context to the exception — for example, the current user action or screen state:

```kotlin Kotlin
try {
    val array = IntArray(1)
    val i = array[2]
} catch (e: Exception) {
    val data = HashMap<String, String>()
    data["screen"] = "CheckoutFragment"
    data["action"] = "submitOrder"
    Connect.logException(e, data)
}
```

## Mark as unhandled

If you are catching an exception that would normally be unhandled — for example, in a global error boundary — pass `unhandled = true` so Connect treats it as a crash:

```kotlin Kotlin
Connect.logException(e, data, unhandled = true)
```

# API reference

For the full `logException` signature, see [Connect Android SDK: event and data logging](https://developer.goacoustic.com/acoustic-connect/docs/connect-android-sdk-reference-logging).