Question about the new `com.android.kotlin.multipl...
# multiplatform
s
Question about the new
com.android.kotlin.multiplatform.library
(
com.android.kotlin.multiplatform.library:com.android.kotlin.multiplatform.library.gradle.plugin
) plugin. Is this for KMP modules, which specifically want to have an Android target so that they can access android-specific classes/features? Otherwise, for KMP modules which were already targeting the JVM and could be imported into Android modules just as pure JVM dependencies, there is no reason to use this new plugin. Do I understand this correctly, or not?
t
What do you mean by android specific classes/features?
e
Its for KMP libraries that want to provide an android target, ces’t fini. The reasons for that are not just to access android classes (eg you need an android target if you need to depend on other android (possibly kmp) libraries). For example, A KMP library having only jvm will not be automatically resolved in a consuming KMP project with an android target if the common dependency is used. This would break assumption / convention for users of KMP for instance. Youre right however that you could just use the kmp jvm part directly in your consuming project.
s
Yeah, just a bit confused about when I would actually use this is my question. I will admit I didn't follow your answer completely Efeturi. Basically, right now I have a bunch of jvm modules which I want to make KMP compatible by adding iOS targets to them. And I stumbled upon this android MP plugin and I wondered if I need to use this in any way, or if I can just ignore it and just provide iOS + jvm targets and continue consuming them from my Android app as I did previously. And then also consume them from an iOS app since it will be the new target.
r
As I understand it, moving forward it will be the supported way of adding an Android target to a KMP library. If you were using
androidTarget()
before, you can replace it with
androidLibrary()
in the new plugin. If you were just doing jvm stuff previously then nothing changes.
thank you color 1