https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

rsetkus

11/10/2020, 3:36 PM
Hi. Trying to publish artifacts to local maven but getting weird error for Android target. When add this to android target
Copy code
android {
    publishLibraryVariants("release", "debug")
}
I get error:
Copy code
> 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:
Copy code
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? 🤔
l

louiscad

11/10/2020, 4:16 PM
@rsetkus Did you try
publishAllLibraryVariants()
?
r

rsetkus

11/10/2020, 4:19 PM
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! 🤯
4 Views