Trying to publish library artefacts to private rep...
# multiplatform
a
Trying to publish library artefacts to private repo. Got a following error
Copy code
> Failed to notify project evaluation listener.
   > Kotlin target 'android' tried to set up publishing for Android build variants that are not library variants or do not exist:
     * release
     Check the 'publishLibraryVariants' property, it should point to existing Android library variants. Publishing of application and test variants is not supported.
   > Kotlin target 'android' tried to set up publishing for Android build variants that are not library variants or do not exist:
     * release
     Check the 'publishLibraryVariants' property, it should point to existing Android library variants. Publishing of application and test variants is not supported.
i
I think you need to use proper gradle task with variants. like
Copy code
artifact bundleLiveReleaseAar
Live
is the build Variant, check your build variant name and try with correct task, all the task you can find in Intellij Right side gradle tab or you can try cmd line
gradle tasks
k
Did you add:
Copy code
kotlin {
    android {
        publishLibraryVariants("release", "debug")
    }
}
in your
build.gradle
file? https://kotlinlang.org/docs/reference/mpp-publish-lib.html#publish-an-android-library
a
@KamilH yes I did, and after that I got this message. Without these lines I doesn’t have this error, but android artefacts are absent. I added.
Copy code
kotlin {
    android {
        publishLibraryVariants("release")
    }
}
And I have only two build variants debug and release
l
Try switching the order in which you apply kotlin and android plugins.
a
@louiscad It helped, thank you very much 🙏
👌 1