Hi all :wave: starting a new MPP project using Kot...
# multiplatform
i
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
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
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
Hope it works out! Let us know if there are things that could be improved.
👌 1
k
If you have android as a target, you have to use the
com.android.library
plugin
👌 1
i
Yeap that was just it, figured that one out yesterday but appreciate the post.