Я следовал инструкциям и добавил зависимость androidx.navigation:navigation-compose с версией 2.7.7.
Код: Выделить всё
// /gradle/libs.versions.toml
[versions]
compose = "1.6.2"
compose-plugin = "1.6.0"
junit = "4.13.2"
kotlin = "1.9.22"
kotlin-serialization-json = "1.6.3"
ktor = "2.3.10"
coroutines = "1.8.0"
nav = "2.6.0"
[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlin-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization-json" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-nav = { module = "androidx.navigation:navigation-compose", version.ref = "nav" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-engine = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
[plugins]
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
Код: Выделить всё
// /composeApp/build.gradle.kts
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.jetbrainsCompose)
}
kotlin {
jvm("desktop")
sourceSets {
val desktopMain by getting
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
// implementation(kotlin.serialization.json)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.engine)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.compose.nav)
}
desktopMain.dependencies {
implementation(compose.desktop.currentOs)
}
}
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "com.myproject"
packageVersion = "1.0.0"
}
}
}
Код: Выделить всё
:composeApp:commonMain: Could not resolve androidx.compose.animation:animation:1.5.1.
Required by:
project :composeApp > androidx.navigation:navigation-compose:2.7.7
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Код: Выделить всё
:composeApp:commonMain: Could not resolve androidx.compose.runtime:runtime:1.5.1.
Required by:
project :composeApp > androidx.navigation:navigation-compose:2.7.7
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Может ли кто-нибудь мне помочь?
Подробнее здесь: https://stackoverflow.com/questions/783 ... rm-project
Мобильная версия