Setting Up Koin
This guide covers everything you need to add Koin to your project.
Quick Setup
Choose your platform to get started:
| Platform | Package | Guide |
|---|---|---|
| Kotlin/JVM | koin-core | Gradle Setup |
| Android | koin-android | Gradle Setup |
| Compose (Multiplatform) | koin-compose | Gradle Setup |
| Kotlin Multiplatform | koin-core | Gradle Setup |
| Ktor | koin-ktor | Gradle Setup |
Recommended Setup: BOM + Compiler Plugin
For the best experience, we recommend:
- Use the Koin BOM - Manages all version compatibility
- Use the Koin Compiler Plugin - Provides compile-time safety
// settings.gradle.kts
plugins {
id("io.insert-koin.compiler.plugin") version "1.0.0" apply false
}
// app/build.gradle.kts
plugins {
id("io.insert-koin.compiler.plugin")
}
dependencies {
implementation(platform("io.insert-koin:koin-bom:4.2.0"))
implementation("io.insert-koin:koin-android") // or koin-core, koin-ktor, etc.
}
Setup Guides
Gradle Setup
Complete dependency configuration for all platforms:
- Koin BOM (recommended)
- Version catalogs
- Platform-specific packages
- Testing dependencies
Compiler Plugin Setup
Detailed guide for the Koin Compiler Plugin:
- Gradle plugin configuration
- Configuration options
- Kotlin version requirements
- Troubleshooting
KSP Annotations Setup (Deprecated)
Legacy setup for KSP-based annotations:
- ⚠️ Deprecated - migrate to Compiler Plugin
- Migration guide included
Version Compatibility
| Koin Version | Kotlin Version | Compiler Plugin |
|---|---|---|
| 4.2.x | 1.9+ / 2.x | ✅ Recommended |
| 4.1.x | 1.9+ / 2.x | ✅ Supported |
| 4.0.x | 1.9+ | ⚠️ KSP only |
| 3.5.x | 1.8+ | ❌ Not available |
Current Version
Find all Koin packages on Maven Central.
Next Steps
After setup:
- Core Concepts - Learn how to use Koin
- Tutorials - Build your first app
- Integrations - Platform-specific features