Thread
#multiplatform
    rsetkus

    rsetkus

    1 year ago
    Hi. Trying to publish artifacts to local maven but getting weird error for Android target. When add this to android target
    android {
        publishLibraryVariants("release", "debug")
    }
    I get error:
    > Kotlin target 'android' tried to set up publishing for Android build variants that are not library variants or do not exist:
         * release
         * debug
    But when I add
    buildType
    block to android configuration block like this:
    android {
        ....
        buildTypes {
            val release by creating {
               isMinifyEnabled = false
            }
            val debug by creating {
                isDebuggable = true
            }
        }
    }
    I get error:
    Please initialize at least one Kotlin target in 'kommon (:kommon)'.
    Seems that
    release
    and
    debug
    build types are set by default. So why
    publishLibraryVariants("release", "debug")
    produce error? 🤔
    louiscad

    louiscad

    1 year ago
    @rsetkus Did you try
    publishAllLibraryVariants()
    ?
    rsetkus

    rsetkus

    1 year ago
    Yeah, I tried it. No error but no output as well. However, made a search on Slack and found what caused the issue. Apparently, android library plugin declaration has to come before multiplatform. Very tricky one! 🤯