While publishing an Android library from my KMM li...
# multiplatform
s
While publishing an Android library from my KMM library, i am facing something very weird, I am probably missing a step in the middle If my
build.gradle
file doesn't have an
artifact-id
the library that gets published works fine. Without artifactId
Copy code
group = "io.data.shared"
version = "1.0"
my content of my maven repo looks like this (which is fine):
Copy code
5206 Oct 27 21:42 shared-android-1.0-sources.jar
10971 Oct 27 21:42 shared-android-1.0.aar
8813 Oct 27 21:42 shared-android-1.0.module
6831 Oct 27 21:42 shared-android-1.0.pom
With artifact Id
Copy code
publishing {
    publications {
        create<MavenPublication>("maven") {
            groupId = "io.data.android"
            artifactId = "shared"
            version = "1.0.0"
        }
    }
}
my content of my maven repo looks like this (which isn't android specific):
Copy code
shared-1.0.0-kotlin-tooling-metadata.json
shared-1.0.0-sources.jar
shared-1.0.0.jar
shared-1.0.0.module
shared-1.0.0.pom
j
Are you specifying the library variants to publish?
Copy code
kotlin {
    android {
        publishAllLibraryVariants()
        // or e.g.
publishLibraryVariants("release")
    }
}
t
Is there a way to specify the artifact name for each publication? My project is using the name of the module, but I want a shorter name without camelCase.
j
I've only used the module name as the artifact name. I recall experiencing issues configuring the name manually, so I settled on naming the module for the artifact. I just recall Android having the additional requirement of publishing variants and wasn't sure if that might be a difference in your config.
s
yup, added the additional requirement for android
Copy code
kotlin {
    android {
        publishLibraryVariants("release", "debug")
    }
}