docs(lesson6): make dependency section student copy-paste friendly
This commit is contained in:
1 parent
2ac859f46b
commit
fb828b8796
1 file changed
+19
-8
@@ -55,16 +55,27 @@ kmp-mini-shopping/
|
|||||||
> 目标:让 shared 能发请求、能序列化、能存本地。
|
> 目标:让 shared 能发请求、能序列化、能存本地。
|
||||||
|
|
||||||
### 1. `shared/build.gradle.kts`
|
### 1. `shared/build.gradle.kts`
|
||||||
确认(或添加)这些依赖:
|
直接在 `kotlin { sourceSets { ... } }` 里按下面写(可照抄):
|
||||||
|
|
||||||
- `ktor-client-core`
|
```kotlin
|
||||||
- `ktor-client-content-negotiation`
|
kotlin {
|
||||||
- `ktor-serialization-kotlinx-json`
|
sourceSets {
|
||||||
- `multiplatform-settings-no-arg`
|
commonMain.dependencies {
|
||||||
- `kotlinx-serialization`
|
implementation("io.ktor:ktor-client-core:3.1.3")
|
||||||
|
implementation("io.ktor:ktor-client-content-negotiation:3.1.3")
|
||||||
|
implementation("io.ktor:ktor-serialization-kotlinx-json:3.1.3")
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.1")
|
||||||
|
implementation("com.russhwolf:multiplatform-settings-no-arg:1.1.1")
|
||||||
|
}
|
||||||
|
|
||||||
Android 侧引擎(`shared/androidMain`)需要:
|
androidMain.dependencies {
|
||||||
- `ktor-client-okhttp`(或 Android 引擎)
|
implementation("io.ktor:ktor-client-okhttp:3.1.3")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 如果你项目当前版本不一致,以你项目里已锁定版本为准。
|
||||||
|
|
||||||
### 2. Ktor 官方文档(课堂可直接贴)
|
### 2. Ktor 官方文档(课堂可直接贴)
|
||||||
- Ktor Multiplatform Client 官方教程:
|
- Ktor Multiplatform Client 官方教程:
|
||||||
|
|||||||
Reference in new issue
Block a user