ar-g
05/30/2024, 5:12 PMpublishKotlinMultiplatformPublicationToCustomLocalRepository
). The issue is that when I build b-SDK, I'm getting:
> Could not resolve io.ktor:ktor-client-darwin:2.3.8.
Required by:
project :library > a-sdk:sdk:0.2-kmp > a-sdk:common-network:0.2-kmp
project :library > a-sdk:sdk:0.2-kmp > a-sdk:plugin-universal:0.2-kmp
> No matching variant of io.ktor:ktor-client-darwin:2.3.8 was found. The consumer was configured to find a component for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.0.2', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- Variant 'iosArm64ApiElements-published' capability io.ktor:ktor-client-darwin:2.3.8:
- Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a component for use during runtime, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attributes:
- Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
- Doesn't say anything about its target Java environment (preferred optimized for Android)
...
Just to clarify the configuration for ktor in a-SDK is in separate targets:
sourceSets {
getByName("commonMain") {
dependencies {
implementation(projects.common.utils)
implementation(libs.ktor.core)
implementation(libs.coroutines.core)
implementation(libs.ktor.logging)
}
}
getByName("androidMain") {
dependencies {
implementation(projects.common.platform)
implementation(libs.ktor.okhttp)
implementation(libs.coroutines.android)
}
}
getByName("iosMain") {
dependencies {
implementation(libs.ktor.darwin)
}
}
}
Has anyone dealt with similar issues before?Pablichjenkov
05/30/2024, 6:31 PMar-g
05/30/2024, 9:00 PMPablichjenkov
05/30/2024, 9:12 PMpublishLibraryVariants(...)
kotlin {
// ANDROID
androidTarget {
publishLibraryVariants("release", "debug")
...
}
in the androidTarget DSLPablichjenkov
05/30/2024, 9:17 PMktor-client-darwin
in the wrong sourceset. It should be only in the iOSMain dependenciesar-g
05/31/2024, 9:46 AMgetByName("iosMain") {
dependencies {
implementation(libs.ktor.darwin)
}
}
But this doesn't make sense, why iOS target, can't find it, but stops throwing errors without this module.
Another workaround I thought of is to publish artefacts for all targets ios/android/js for a-SDK and reimport them in android/ios/js source sets of b-SDK as separate dependencies, but this approach seem quite cumbersome. @Pablichjenkov do you know if it's a common practice?tapchicoma
05/31/2024, 10:05 AMPablichjenkov
05/31/2024, 12:49 PM