Я пытаюсь настроить клиент ktor http в модуле commonMain проекта Kotlin Multiplatform (как описано здесь https://ktor.io/clients/http-client/features/json-feature.html),, но не могу разрешить зависимость от него:
val client = HttpClient {
install(JsonFeature) {
serializer = JacksonSerializer()
}
}
Версия Gradle: 4.7.
Вот build.gradle для общего модуля:
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlinx-serialization'
kotlin {
targets {
// Change to `presets.iosArm64` to deploy the app to iPhone
fromPreset(presets.iosX64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
sourceSets {
commonMain.dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-json:$ktor_version"
implementation "io.ktor:ktor-client-jackson:$ktor_version"
}
commonTest {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-test-common"
implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
}
}
iosMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version"
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-core-ios:$ktor_version"
implementation "io.ktor:ktor-client-json-ios:$ktor_version"
}
}
}
}