https://start.insert-koin.io/#/setup/index
开始
Koin in 5 minutes (5分钟快速入手Koin)
Getting Started (开始)
为您的项目配置Koin Koin的最新版本:
1
2
3
4
5
// 最新的stable版本
koin_version = "2.1.6"
// 最新的unstable版本
koin_version = "2.2.0-rc-1"
添加下面这些Gradle依赖来将Koin添加到您的项目中:
Koin已经在Jcenter上发布
1
2
3
4
// Add Jcenter to your repositories if needed
repositories {
jcenter ()
}
Kotlin
1
2
3
4
5
6
7
8
// Koin for Kotlin
implementation "org.koin:koin-core:$koin_version"
// Koin Extended & experimental features
implementation "org.koin:koin-core-ext:$koin_version"
// Koin for Unit tests
testImplementation "org.koin:koin-test:$koin_version"
Gradle Plugin
1
2
3
4
5
6
7
8
9
10
buildscript {
repositories {
jcenter ()
}
dependencies {
classpath "org.koin:koin-gradle-plugin:$koin_version"
}
}
apply plugin: 'koin'
Android
1
2
3
4
5
6
7
8
// Koin for Android
implementation "org.koin:koin-android:$koin_version"
// Koin Android Scope feature
implementation "org.koin:koin-android-scope:$koin_version"
// Koin Android ViewModel feature
implementation "org.koin:koin-android-viewmodel:$koin_version"
AndroidX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Koin AndroidX Scope feature
implementation "org.koin:koin-androidx-scope:$koin_version"
// Koin AndroidX ViewModel feature
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
// Koin AndroidX Fragment Factory
implementation "org.koin:koin-androidx-fragment:$koin_version"
// Koin AndroidX Work Manager (unstable version)
implementation "org.koin:koin-androidx-workmanager:$koin_version"
// Koin AndroidX Compose (unstable version)
implementation "org.koin:koin-androidx-compose:$koin_version"
Ktor
1
2
// Koin for Ktor Kotlin
implementation "org.koin:koin-ktor:$koin_version"
Licensed under CC BY-NC-SA 4.0