Slackbot
01/03/2024, 10:19 AMRaed Ghazal
01/03/2024, 10:19 AMplugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinCocoapods)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.mavenPublish)
}
mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01)
signAllPublications()
coordinates("com.raedghazal", "kotlinx_datetime_ext", "1.0.1")
pom {
name.set("Kotlinx datetime ext")
description.set("A KMM library that provides extensions and helper functions for kotlinx-datetime ")
inceptionYear.set("2023")
url.set("<https://github.com/RaedGhazal/kmm-kotlinx-datetime-ext>")
developers {
developer {
id.set("RaedGhazal")
name.set("Raed Ghazal")
url.set("<https://github.com/RaedGhazal>")
}
}
licenses {
license {
name.set("MIT License")
url.set("<https://opensource.org/license/mit/>")
distribution.set("<https://opensource.org/license/mit/>")
}
}
scm {
url.set("<https://github.com/RaedGhazal>")
connection.set("scm:git:<git://github.com/RaedGhazal/kmm-kotlinx-datetime-ext.git>")
developerConnection.set("scm:git:<ssh://git@github.com/RaedGhazal/kmm-kotlinx-datetime-ext.git>")
}
}
}
kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
framework {
baseName = "shared"
isStatic = true
}
}
sourceSets {
commonMain.dependencies {
implementation(commonlibs.kotlinx.datetime)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
}
}
}
android {
namespace = "com.raedghazal.kotlinx_datetime_ext"
compileSdk = 34
defaultConfig {
minSdk = 26
}
}
dependencies {
implementation(commonlibs.androidx.core.ktx)
}Raed Ghazal
01/03/2024, 10:20 AM1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.raedghazal:kotlinx_datetime_ext:1.0.1.
Required by:
project :app > project :shared
> No matching variant of com.raedghazal:kotlinx_datetime_ext:1.0.1 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 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.1.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- Variant 'iosArm64ApiElements-published' capability com.raedghazal:kotlinx_datetime_ext:1.0.1:
- 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.1.0')
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Doesn't say anything about its target Java environment (preferred optimized for Android)Raed Ghazal
01/03/2024, 10:21 AM- Variant
162 are iosSomething and 36 are metadataSomethingRaed Ghazal
01/03/2024, 10:22 AMVampire
01/03/2024, 10:43 AMVampire
01/03/2024, 10:44 AMandroidTarget is what you wanted to use. Have a look at https://kotlinlang.org/docs/multiplatform-publish-lib.html#publish-an-android-libraryRaed Ghazal
01/03/2024, 10:58 AMRaed Ghazal
01/03/2024, 10:58 AMRaed Ghazal
01/03/2024, 10:59 AMVampire
01/03/2024, 10:59 AMRaed Ghazal
01/03/2024, 10:59 AMVampire
01/03/2024, 11:00 AMVampire
01/03/2024, 11:00 AMRaed Ghazal
01/03/2024, 11:00 AMRaed Ghazal
01/03/2024, 11:01 AMVampire
01/03/2024, 11:02 AMah, I was trying to find it but didn’t know which file, thanks as wellhttps://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html
Vampire
01/03/2024, 11:03 AMRaed Ghazal
01/03/2024, 11:03 AMVampire
01/03/2024, 11:05 AMRaed Ghazal
01/03/2024, 11:06 AM