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

Ivann Ruiz

08/26/2020, 7:46 PM
Hi all 👋 starting a new MPP project using Kotlin 1.4, lemme pick your brains a bit. In my app's
build.gradle.kts
file I can create ios/android targets by adding these lines👇 it all compiles and runs fine.
Copy code
plugins {
    kotlin("multiplatform")
}

kotlin {
    ios()
    android()
}
but when i try to put this same logic in the
build.gradle.kts
of a new
:common
module it just won't work. First it gives me an error on the
android()
line. Second, i get around this by adding
jvm("android")
instead, but then my app crashes when running. The point of doing this is so I can have all the multiplatform gradle code separate from the app gradle. Thoughts?
k

kpgalligan

08/26/2020, 7:47 PM
I don’t have a lot of thoughts, but we just updated our sample app to 1.4: https://github.com/touchlab/KaMPKit
🙌 1
It has shared code in a separate module
i

Ivann Ruiz

08/26/2020, 7:48 PM
Oh nice! Taking a look 👀
@kpgalligan wow this is awesome! it's so true, the biggest roadblock for KMP is getting started. Spent soo many hours going through countless website/tutorials/posts just to get my KMP frankenstein projects going.
k

kpgalligan

08/26/2020, 7:56 PM
Hope it works out! Let us know if there are things that could be improved.
👌 1
k

Kurt Renzo Acosta

08/27/2020, 12:09 PM
If you have android as a target, you have to use the
com.android.library
plugin
👌 1
i

Ivann Ruiz

08/27/2020, 7:12 PM
Yeap that was just it, figured that one out yesterday but appreciate the post.