С тех пор, как я начал учиться использовать мультиплатформенность Kotlin с Compose, у меня постоянно возникают проблемы с синхронизацией Gradle, и я хотел бы знать, что это значит. Я публикую пример ошибки, но это произошло со многими библиотеками, и даже с теми, которые были в порядке всего неделю назад. Поэтому мне хотелось бы знать, что я делаю не так, чтобы двигаться дальше.
Пример ошибки:
:composeApp:iosArm64Main: не удалось разрешить org.jetbrains.kotlinx:kotlinx-coroutines- android:1.7.3.
Требуется:
проект :composeApp > com.google.android.material:material:1.12.0 > androidx.activity:activity:1.8.0 > androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.5
build. gradle.kts
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.ksp)
alias(libs.plugins.ktorfit)
alias(libs.plugins.buildkonfig)
alias(libs.plugins.serialization)
}
kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_22)
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
sourceSets {
androidMain.dependencies {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.compose.google.fonts)
implementation(libs.ktorfit)
implementation(libs.kotlinx.serialization.json)
implementation(libs.ktorfit.converters.call)
implementation(libs.qr.kit)
implementation(libs.androidx.navigation)
implementation(libs.androidx.compose.material)
}
}
}
android {
namespace = "xxx"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
applicationId = "xxx"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "0.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_22
targetCompatibility = JavaVersion.VERSION_22
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
}
dependencies {
debugImplementation(compose.uiTooling)
}
buildkonfig {
packageName = "xxx"
xxx
}
}
libs.versons.toml
[versions]
agp = "8.7.2"
android-compileSdk = "35"
android-minSdk = "31"
android-targetSdk = "34"
androidx-activityCompose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-constraintlayout = "2.2.0"
androidx-core-ktx = "1.15.0"
androidx-espresso-core = "3.6.1"
androidx-lifecycle = "2.8.4"
androidx-test-junit = "1.2.1"
androidx-material = "1.12.0"
androidx-compose-google-fonts="1.7.5"
androidx-navigation = "2.8.0-alpha10"
compose-multiplatform = "1.7.0"
junit = "4.13.2"
kotlin = "2.0.21"
ktorfit = "2.2.0"
ksp = "2.0.21-1.0.28"
okio = "3.9.1"
buildkonfig = "0.15.2"
serialization-json = "1.7.3"
qrkit = "3.0.5"
[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" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-compose-google-fonts = { group = "androidx.compose.ui", name = "ui-text-google-fonts", version.ref = "androidx-compose-google-fonts"}
androidx-compose-material = { group = "com.google.android.material", name = "material" , version.ref = "androidx-material"}
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
androidx-navigation = { group = "org.jetbrains.androidx.navigation", name = "navigation-compose", version.ref = "androidx-navigation"}
ktorfit = { group = "de.jensklingenberg.ktorfit", name = "ktorfit-lib", version.ref = "ktorfit"}
squareup-okio = { group = "com.squareup.okio", name = "okio", version.ref = "okio" }
buildkonfig = { group = "com.codingfeline.buildkonfig", name = "buildkonfig-gradle-plugin", version.ref = "buildkonfig"}
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization-json"}
ktorfit-converters-call = { group = "de.jensklingenberg.ktorfit", name = "ktorfit-converters-call", version.ref = "ktorfit"}
qr-kit = { group = "network.chaintech", name = "qr-kit", version.ref = "qrkit"}
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" }
buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig"}
jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}
Подробнее здесь: https://stackoverflow.com/questions/792 ... ync-issues
Проблемы с многоплатформенной синхронизацией Gradle Kotlin ⇐ Android
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Проблема с синхронизацией Gradle Kotlin после стабильного обновления Android 3.1
Anonymous » » в форуме Android - 0 Ответы
- 13 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Проблема с синхронизацией Gradle Kotlin после стабильного обновления Android 3.1
Anonymous » » в форуме Android - 0 Ответы
- 10 Просмотры
-
Последнее сообщение Anonymous
-