generatePomFileForAndroidPublication fails
# multiplatform
c
generatePomFileForAndroidPublication fails
🧵 7
c
The 🧵 should tell you to move the long code snippets in here, to the thread.
c
Why does this issue occur how to fix it?
Copy code
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

    * Try:
    > Ambiguity errors are explained in more detail at <https://docs.gradle.org/8.7/userguide/variant_model.html#sub:variant-ambiguity>.
    > Review the variant matching algorithm at <https://docs.gradle.org/8.7/userguide/variant_attributes.html#sec:abm_algorithm>.
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at <https://help.gradle.org>.
    BUILD FAILED in 6s
    72 actionable tasks: 16 executed, 56 up-to-date
My build.gradle.kts
Copy code
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"
Is it okay now?
👍 1