KMP generatePomFileForAndroidPublication fails

Why does this issue occurs how to fix it?

“` Execution failed for task ‘:sevenzip-javm:generatePomFileForAndroidPublication’.

Could not apply withXml() to generated POM The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’. However we cannot choose between the following variants of project :androidCoreTools: – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-classes-jar’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Provides its elements packaged as a jar but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-lint’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Provides its elements packaged as a jar but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-lint-local-aar’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-manifest’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-renderscript declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-renderscript’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant android-symbol-with-package-name declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘android-symbol-with-package-name’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘jar’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Provides its elements packaged as a jar but the consumer didn’t ask for it – Configuration ‘:androidCoreTools:releaseApiElements’ variant r-class-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute ‘com.android.build.api.attributes.AgpVersionAttr’ with value ‘8.2.0’, attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘release’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’: – Unmatched attributes: – Provides attribute ‘artifactType’ with value ‘r-class-jar’ but the consumer didn’t ask for it – Provides attribute ‘com.android.build.gradle.internal.attributes.VariantAttr’ with value ‘release’ but the consumer didn’t ask for it – Provides its elements packaged as a jar but the consumer didn’t ask for it

“`

My build.gradle.kts “` plugins { alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.android.library) // id(“module.publication”) // id(“dev.icerock.mobile.multiplatform-resources”) // id(“com.vanniktech.maven.publish”) alias(libs.plugins.vanniktech.publish) id(“org.example.binary-downloader”) version “1.0-SNAPSHOT” }

kotlin { applyDefaultHierarchyTemplate() jvm()

androidTarget { publishLibraryVariants("release") kotlin { jvmToolchain(17) } 

// compilations.all { // kotlinOptions { // jvmTarget = “17” // } // } // publishAllLibraryVariants() // publishLibraryVariantsGroupedByFlavor = true // This line }

// iosX64() // iosArm64() // iosSimulatorArm64() // linuxX64()

sourceSets { commonMain.dependencies { implementation("org.example:coreTools:1.0-SNAPSHOT") 

// implementation(project(“:sevenzip-wrapper”))

// implementation(libs.resources) // implementation(project(“:process”)) // implementation(libs.klogging.jvm) // implementation(libs.kotlinx.coroutines.core) // implementation(libs.kotlin.result) // implementation(project(“:sevenzip-wrapper”)) { //// isTransitive = true // } }

 commonTest.dependencies { implementation(libs.kotlin.test) } androidMain.dependencies { 

// implementation(“org.example:coreTools:1.0-SNAPSHOT”) implementation(libs.kotlinx.coroutines.core) implementation(“org.example:androidCoreTools:1.0-SNAPSHOT”)

 api("org.example:sevenzip-wrapper:1.0-SNAPSHOT") } jvmMain { dependencies { implementation(libs.kotlinx.coroutines.core) api("org.example:sevenzip-wrapper:1.0-SNAPSHOT") } } } 

}

android { namespace = “org.jetbrains.kotlinx.multiplatform.library.sevenZip” compileSdk = libs.versions.android.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.android.minSdk.get().toInt() }

}

group = “org.example” version = “1.0-SNAPSHOT”

“`

submitted by /u/One_Understanding186
[link] [comments]