https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
o

oshai

07/21/2020, 6:17 AM
Hi, is it possible with multiplatform to create two separate jvm modules? I would like to have one for regular JVM and one for Android. Or is it because it's the same platform that is impossible?
d

Desmond Teo

07/21/2020, 6:19 AM
yes it’s possible, there’s
jvm()
and
android()
which you can call in the
kotlin { }
block in the gradle file
❤️ 1
o

oshai

07/21/2020, 6:38 AM
thanks, do you know if there is such an example available?
d

Desmond Teo

07/21/2020, 6:39 AM
https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets this shows how to set up the different targets (jvm and android for your case)
might also be helpful to read up the Android support section https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#android-support
o

oshai

07/21/2020, 6:42 AM
Thanks! is it possible two have two seperate implementations for the same platform (like two jvm modules or two android modules) by specifying different names?
a

andylamax

07/21/2020, 8:28 AM
You can have as many jvm targets as you want. But you can have only one android target
s

StefMa

07/21/2020, 8:29 AM
It should be possible with a
jvm
target. Just give it a different name
jvm("first")
and
jvm("second")
a

andylamax

07/21/2020, 8:29 AM
and yes, each of them can have different implementations
o

oshai

07/21/2020, 7:26 PM
good to know, thanks!
6 Views