Noob android developer here. I have my kotlin mult...
# multiplatform
y
Noob android developer here. I have my kotlin multiplatform project which is currently being used in an iOS project via the framework that is generated by konan. What do i do if i want to use this in an android app? Do i generate a jar file and put it in the host app?
r
You create a
kotlin-platform-android
or
kotlin-platform-jvm
module, with an
expectedBy
dependency on your common module
Then consume it like and other library module
a
@russhwolf It causes IDE error in my case, where the Android studio won’t recognise the kotlin code from the
common
and
platform-android
module (https://stackoverflow.com/questions/50363138/why-i-have-syntax-error-in-ide-after-adding-a-gradle-project-to-another-repo-eve). I ended up by generate an aar file and use it in the android project.
r
Yeah, i’ve seen that. I switched to the IDEA 2018.2 EAP and that seemed to help. There’s not an officially supported multiplatform IDE yet so you have to expect some of these rough edges.