Hi, Currently, is there any workaround to create a...
# kotlin-toolchain
s
Hi, Currently, is there any workaround to create an Android .aar file for a library created using standalone Amper?
j
Hi Sabeeh! I don't know any workaround for now, unfortunately. The publishing story is unfinished at the moment, this is why this area is a bit rough. Amper can build an AAB for the
android/app
product type, and a regular JAR for the
lib
product type. Do you need an AAR because you want to bundle Android resources?
Also, a quick question, are you building a KMP library that happens to target Android as well, or just a pure Android library? (I'm trying to see if an
android/lib
product type would help here, or if there is a need as well for KMP `lib`s)
s
Hi @joffrey, This is a KMP library, and I want to build it for Android. A JAR could also work, but as far as I understand, that would target the JVM (desktop). Currently, I have multiple platforms: Android, iOS, and JVM (Desktop). The library does not contain any Android-specific resources but few library import difference from JVM.
If I use product.type: android/lib, will that allow me to create an Android JAR or AAR file? I can try that.
j
Ah sorry for the confusion, the
android/lib
product type is hypothetical - something we could add. It's not there yet
a
If I use product.type: android/lib, will that allow me to create an Android JAR or AAR file? I can try that.
it probably will when is supported, however, now there is no
android/lib
product type yet
This is a KMP library, and I want to build it for Android. A JAR could also work, but as far as I understand, that would target the JVM (desktop).
When we get to the kmp library publication, we'll deal with packaging for KMP libraries as well, for now product type
lib
is only intended to be consumed by Amper itself I may be wrong, but AFAIK the difference between jar and android jar lays in Gradle module metadata (special json that you put in maven repository alongside with your jar), as far as you can desugar this jar with D8, so if you have no android-specific resources, it's not necessary to produce AAR just in case if you want to publish your library before we come up with some meaningful way how to publish KMP libs by built-in support in case if you actually need android-specific resources anyway, it's still not a goal for KMP library to provide a way to generate AAR for Android part, I guess it's still done through having separate modules (in Gradle now, for instance) for KMP library and android library separately and KMP library depends on Android lib, which contains android resources