# Android (Kotlin) SDK: Modern Analytics for Android


We're pleased to announce the new [Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/" >}}) for faster and efficient event tracking on your Android apps. It delivers up to 4x faster event processing with a modern, extensible architecture. Built with Kotlin coroutines and a plugin-based design, it provides type safety and cleaner payloads.

{{< announcement >}}
RudderStack recommends using the Android (Kotlin) SDK for all new Android implementations. The legacy [Android (Java) SDK]({{< ref "sources/event-streams/sdks/rudderstack-android-sdk/" >}}) will continue to receive maintenance updates but no new features.
{{< /announcement >}}

## Why we built this

The legacy Android SDK served customers well, but modern Android development has evolved significantly. Developers now expect coroutine-based async handling, type-safe APIs, and modular architectures that integrate cleanly with Jetpack libraries.

The legacy SDK's architecture made it difficult to add new capabilities without increasing complexity. Customers who wanted to customize event payloads or add custom processing logic had to wait for SDK team updates, thereby creating bottlenecks and slowing their implementation timelines.

The Android (Kotlin) SDK addresses these limitations with a ground-up redesign that embraces modern Android practices and gives you the extensibility to customize your implementation without waiting for SDK changes.

## Key benefits

This section lists some key benefits of using the Android (Kotlin) SDK.

### Performance

- **4x faster event processing**: Optimized batching and burst handling dramatically improve event delivery speed to the data plane server

### Developer experience

- **Coroutine-based async**: Structured concurrency with proper lifecycle management replaces manual thread handling
- **Type safety**: Compile-time safety with Kotlin's type system catches errors before runtime
- **`NavController` integration**: Automatic screen tracking with Android Navigation Component, including Compose support

### Extensibility

- **Plugin architecture**: Modular design lets you add custom plugins to modify, enrich, or process events without waiting for SDK updates
- **Multi-instance support**: Run multiple SDK instances with different write keys in the same application

### Maintainability

- **Cleaner payloads**: Reduced redundancy by removing duplicate fields like `context.traits.anonymousId`, resulting in smaller and more consistent event data

## How to use the SDK

For installation, initialization, and API usage, see the [Android (Kotlin) SDK Quickstart]({{< ref "sources/event-streams/sdks/kotlin-sdk/quickstart.md" >}}). For configuration options, see [SDK Configuration Options]({{< ref "sources/event-streams/sdks/kotlin-sdk/configuration-options.md" >}}).

## New and improved features

**New features**

- [Plugin architecture]({{< ref "sources/event-streams/sdks/client-side-features/plugin-architecture/" >}}): Add, remove, and customize plugins at runtime 
- [Automatic screen tracking with `NavController`]({{< ref "sources/event-streams/sdks/client-side-features/automatic-screen-tracking.md#navigation-destination-tracking" >}}): Track navigation destinations automatically with Fragment-based and Compose navigation
- [Multiple instances]({{< ref "sources/event-streams/sdks/client-side-features/multiple-instance-support.md" >}}): Run separate SDK instances for different data sources
- [Shutdown API]({{< ref "sources/event-streams/sdks/mobile-sdk-apis/shutdown.md" >}}): Clean up SDK resources during runtime with `analytics.shutdown()`

See the [New Features in Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/new-features/_index.md" >}}) guide for more information.

**Improvements over legacy SDK**

- **Configuration**: Replace RudderConfig.Builder() chains with a direct `Configuration(...)` constructor
- **Properties**: Use `buildJsonObject { }` for compile-time type safety instead of `RudderProperty().putValue()` with runtime checks
- **Async handling**: Native coroutine integration replaces manual thread management
- **Plugin management**: Add and remove plugins dynamically at runtime with `add()` / `remove()`

A sample SDK configuration is shown below:

```kotlin
// Kotlin SDK - cleaner, no builder pattern
val config = Configuration(
    writeKey = "WRITE_KEY",
    application = application,
    dataPlaneUrl = "DATA_PLANE_URL",
    logLevel = LogLevel.DEBUG
)
```

An example of type-safe properties is shown below:

```kotlin
val properties = buildJsonObject {
    put("product_id", "12345")
    put("price", 99.99)
}
```

See the following guides for more information:

- [Improved Features in Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/new-features/improved-features.md" >}})
- [Breaking Changes in Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/breaking-changes.md" >}})

## Migrate from legacy Android SDK

{{< success >}}
The legacy Android (Java) SDK continues to work and receive maintenance updates, so you can migrate at your own pace.
{{< /success >}}

The Android (Kotlin) SDK introduces API and payload changes from the legacy Android (Java) SDK. Event payloads remove redundant fields (for example, `context.traits.anonymousId`, `context.traits.userId`, `context.userAgent`) and the library identifier in payloads changes to `com.rudderstack.sdk.kotlin.android`.

{{< warning >}}
If your downstream systems rely on these removed fields, make sure to update your transformations before migrating.
{{< /warning >}}

See the following guides for detailed API differences and migration process:

- [Breaking Changes in Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/breaking-changes.md" >}}): For differences in SDK initialization, event API, and configuration mapping 
- [Migration Guide]({{< ref "sources/event-streams/sdks/kotlin-sdk/migration-guide.md" >}}): Migrate persisted SDK data (`anonymousId`, `userId`, traits, etc.)

## SDK versions

| SDK | Latest version |
| --- | --- |
| Android (Kotlin) SDK | 1.2.0 |

## Platform requirements

| Platform | Minimum version |
| --- | --- |
| Android API | 21+ (Lollipop) |
| Kotlin | 1.7.0+ |
| Java | 8+ |

## Resources

See the following resources for learning more about the Android (Kotlin) SDK:

- [Android (Kotlin) SDK Overview]({{< ref "sources/event-streams/sdks/kotlin-sdk/" >}})
- [New Features in Android (Kotlin) SDK]({{< ref "sources/event-streams/sdks/kotlin-sdk/new-features/_index.md" >}})
- [Plugin Architecture]({{< ref "sources/event-streams/sdks/client-side-features/plugin-architecture/" >}})
- [Improved Features]({{< ref "sources/event-streams/sdks/kotlin-sdk/new-features/improved-features.md" >}})
- [Breaking Changes]({{< ref "sources/event-streams/sdks/kotlin-sdk/breaking-changes.md" >}})

The following guides will help you get started with the Android (Kotlin) SDK:

- [Quickstart Guide]({{< ref "sources/event-streams/sdks/kotlin-sdk/quickstart.md" >}})
- [SDK Configuration Options]({{< ref "sources/event-streams/sdks/kotlin-sdk/configuration-options.md" >}})
- [Migration Guide]({{< ref "sources/event-streams/sdks/kotlin-sdk/migration-guide.md" >}})
