Multiplifform Android -сборка Kotlin не удастся выбрать вариант 'org.jetbrains.skiko: skiko', который соответствует атриAndroid

Форум для тех, кто программирует под Android
Ответить
Гость
 Multiplifform Android -сборка Kotlin не удастся выбрать вариант 'org.jetbrains.skiko: skiko', который соответствует атри

Сообщение Гость »

Я сталкиваюсь с сбоем сборки Gradle в моем проекте Cotlin Multiplatform при создании цели Android. Ошибка указывает на то, что Gradle не может автоматически выбрать соответствующий вариант библиотеки Skiko для Android.
Сообщение об ошибке:

Код: Выделить всё

* What went wrong:
Execution failed for task ':android:kspKotlin'.
> Could not resolve all files for configuration ':android:kspKotlinProcessorClasspath'.
> Could not resolve org.jetbrains.skiko:skiko:0.9.4.2.
Required by:
project :android > com.github.EAM-25.RWPP:core:26035f85b2 > com.github.EAM-25.RWPP:rwpp-core-desktop:26035f85b2 > org.jetbrains.compose.foundation:foundation:1.8.2 > org.jetbrains.compose.foundation:foundation-desktop:1.8.2
project :android > com.github.EAM-25.RWPP:core:26035f85b2 > com.github.EAM-25.RWPP:rwpp-core-desktop:26035f85b2 > org.jetbrains.compose.ui:ui:1.8.2 > org.jetbrains.compose.ui:ui-desktop:1.8.2
project :android > com.github.EAM-25.RWPP:core:26035f85b2 > com.github.EAM-25.RWPP:rwpp-core-desktop:26035f85b2 > org.jetbrains.compose.foundation:foundation:1.8.2 > org.jetbrains.compose.foundation:foundation-desktop:1.8.2 > org.jetbrains.compose.ui:ui-text:1.8.2 > org.jetbrains.compose.ui:ui-text-desktop:1.8.2
project :android > com.github.EAM-25.RWPP:core:26035f85b2 > com.github.EAM-25.RWPP:rwpp-core-desktop:26035f85b2 > org.jetbrains.compose.material3:material3:1.8.2 > org.jetbrains.compose.material3:material3-desktop:1.8.2 > org.jetbrains.compose.ui:ui-graphics:1.8.2 > org.jetbrains.compose.ui:ui-graphics-desktop:1.8.2
> Cannot choose between the available variants of org.jetbrains.skiko:skiko:0.9.4.2:
- androidRuntimeElements-published
- awtRuntimeElements-published
... [additional variant mismatch details]
Соответствующая build.gradle.kts
android-модуль

Код: Выделить всё

import java.io.FileOutputStream

plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose")
id("com.google.devtools.ksp")
}

ksp {
arg("outputDir", project.buildDir.absolutePath + "/generated")
arg("libDir", "$rootDir/lib")
arg("lib","android-game-lib")
}
configurations.all{
resolutionStrategy{
force("org.jetbrains.kotlin:kotlin-stdlib:2.2.0")
force("org.jetbrains:annotations:23.0.0")
}
}
dependencies {
implementation(project(":common"))
compileOnly(fileTree(
"dir" to rootDir.absolutePath + "/lib",
"include" to listOf("android-game-lib.jar","android.jar")
))

ksp("com.github.EAM-25.RWPP:ksp:26035f85b2")
}

val sdkRoot = System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")

val buildToolsVersion = findProperty("build.tools.version") as String

val d8Path = if (System.getProperty("os.name").toLowerCase().contains("windows")) {
"$sdkRoot/build-tools/$buildToolsVersion/d8.bat"
} else {
"$sdkRoot/build-tools/$buildToolsVersion/d8"
}

tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveFileName.set("Android.jar")

from(configurations.runtimeClasspath.get().mapNotNull {
if (it.name.contains("kotlin-stdlib") ||
it.name.startsWith("annotations-") )
return@mapNotNull null
if (it.isDirectory)
it
else zipTree(it)
})

from(buildDir.absolutePath + "/generated") {
include("config.toml")
rename("config.toml", "inject_android.toml")
}
}

val jarAndroid by tasks.registering {
dependsOn(tasks.jar)

doLast {
if (sdkRoot.isNullOrBlank() || !File(sdkRoot).exists()) {
throw GradleException("No valid Android SDK found. Make sure that ANDROID _ HOME or ANDROID _ SDK _ ROOT points to your Android SDK directory.")
}

val platformRoot = File("$sdkRoot/platforms/").listFiles()
?.sortedDescending()
?.find { File(it, "android.jar").exists() }

if (platformRoot == null) {
throw GradleException("Android. Jar not found.  Make sure you have the Android platform installed.")
}

val classpathFiles =listOf(File("D:\\AndroidIDEProjects\\BattleOptions\\common\\build\\libs\\common-1.0.jar"))
val argsFile = File.createTempFile("d8_args", ".txt", buildDir).apply {
deleteOnExit()
writeText(
classpathFiles.joinToString("\n") { it.path }
)
}
project.exec {
workingDir = file("$buildDir/libs")
commandLine = listOf(
d8Path,
//"--classpath", "@${argsFile.absolutePath}",
"--min-api", "26",
"--output", "Output.jar",
"Android.jar"
)
standardOutput = FileOutputStream("$buildDir/libs/d8_stdout.txt")
errorOutput = FileOutputStream("$buildDir/libs/d8_stderr.txt")
/*standardOutput = System.out
errorOutput = System.err*/
}
}
}

Common Module

Код: Выделить всё

plugins {
java
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jetbrains.compose")
id("org.jetbrains.kotlin.plugin.compose")
}

dependencies {
api("com.github.EAM-25.RWPP:core:26035f85b2")
}
сканирование сборки
scan
Основной вопрос
Как правильно настроить зависимость Skiko в моем проекте KM>

Подробнее здесь: https://stackoverflow.com/questions/797 ... of-org-jet
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»