How can I build a .aar file for my Kotlin Multiplatform Mobile project that includes the commonMain ...
s
How can I build a .aar file for my Kotlin Multiplatform Mobile project that includes the commonMain code as well? I have a KMM app that I would like to render as a widget in existing android and iOS apps. I'm not sure how to get the binaries for android and iOS separately so that I can add those to my existing projects.
p
I believe it is asked two comments above, check this link: https://kotlinlang.org/docs/multiplatform-build-native-binaries.html I've only used the kmp libraries in the form of klibs not as specific platform binaries(framework or aar) so I can't really tell much, but give it a try the above link.
j
Android is the only KMP target that doesn't include artifacts in publications by default because you need to specify which variants to include. E.g.:
Copy code
kotlin {
    android {
        publishLibraryVariants("release")
    }
}
https://kotlinlang.org/docs/multiplatform-publish-lib.html#publish-an-android-library This will publish a
-android
.aar artifact alongside other KMP target artifacts (.jar for JVM, .klib for native and JS).
812 Views