Satyam Gondhale
06/05/2025, 10:17 AM.aar
file and give multiplatform support for downstream consumers.
• .aar
does not include code or targets for other platforms (iosMain
, desktopMain
, jsMain
, etc.) as It is a binary artifact targeting Android only.
• If the recipient now wants to build for multiple platforms, they must Use the KMM Module as a source dependency, not aar
• That means, Get access to your shared
module *source code, a*dd it to their own Kotlin Multiplatform project, declare targets (ios()
, desktop()
, wasm()
, etc.), include it in their settings.gradle.kts
• Alternatively, If you want to distribute your shared
module as a true multiplatform library (not just Android .aar
), you can publish it to maven repo as (.jar
, .klib
, .framework
, etc.) & consumers can then use it in their kotlin {}
source sets.
• With this the consumer will be able to Build and run their project for Desktop, iOS, JS, or other KMP-supported platforms, as long as their project is also set up as a CMP project.Daniel Dello
06/05/2025, 12:41 PMpublish
plugin it will generate the correct distributions for each build type (.aar
for android, .jar
for jvm, etc) and you can import those in pure android projects without issues.
I haven't tested it with iOS and other targets though.Satyam Gondhale
06/05/2025, 1:24 PM