Open iKozlinskyi opened 2 years ago
Join the issue. Anybody can implement androidMain
in Multiplatform sample? It is matter of life and death for me 🥺
Seems like I solved my problem by compileOnly
. Example below:
sourceSets {
val commonMain by getting {
dependencies {
compileOnly("org.jetbrains.skiko:skiko:$version")
}
}
val androidMain by getting {
dependsOn(commonMain)
dependencies {
implementation("org.jetbrains.skiko:skiko-android:$version")
}
}
Before this, I had a problem with 'Duplicate class' error
Hi, I tried to implement this, but I'm still seeing this error:
Unable to resolve dependency for %27%3Ashared%40debug%2FcompileClasspath%27%3A Could not resolve org.jetbrains.skiko%3Askiko%3A0.7.37.
Could not resolve org.jetbrains.skiko:skiko:0.7.37.
Required by:
project :shared
> The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.1.3', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of org.jetbrains.skiko:skiko:0.7.37:
- androidApiElements-published
- androidRuntimeElements-published
- awtApiElements-published
- awtRuntimeElements-published
- samplessources
All of them match the consumer attributes:
The build.gradle.kts is:
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.7.20"
id("com.android.library")
}
val coroutinesVersion = "1.5.2"
val skikoVersion = "0.7.37"
val serialization_version = "1.4.1"
kotlin {
android() {
publishLibraryVariants("release", "debug")
}
}
sourceSets {
val commonMain by getting {
dependencies {
compileOnly("org.jetbrains.skiko:skiko:$skikoVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
}
}
val commonTest by getting {
dependencies {
dependsOn(commonMain)
implementation(kotlin("test"))
}
}
val androidMain by getting {
dependencies {
dependsOn(commonMain)
implementation("org.jetbrains.skiko:skiko-android:$skikoVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
}
}
val androidTest by getting
}
skiko 0.7.93 or 0.8.4:
On android I am getting this (but it works on JVM):
Rejecting re-init on previously-failed class java.lang.Class
This is a multiplatform gradle project. I've tried "compileOnly" and "implementation" in commonMain:
compileOnly("org.jetbrains.skiko:skiko:$skikoVersion")
In my androidMain I've tried these:
implementation("org.jetbrains.skiko:skiko-android:$skikoVersion")
//implementation("org.jetbrains.skiko:skiko-android-runtime-x64:$skikoVersion")
//implementation("org.jetbrains.skiko:skiko-android-runtime-arm64:$skikoVersion")
anybody successfully using skiko outside of compose in multiplatform?
Yes, we use it in kmp (jvm+ android) providing the libraries with runtimeOnly
Hello! I would like to use Skiko in a cross-platform library for apps targeting Web, Android, and iOS. I see an example of KMP+Skiko project, and also an Android+Skiko example. But I struggle to integrate a KMP+Skiko library with an Android project. This seems like a rookie question, but I encountered various problems trying to use the multiplatform library and an android project having both Skiko as a dependency. It would be great if you also updated the KMP+Skiko example with an Android target.