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

yusuf3000

05/24/2018, 11:40 AM
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

russhwolf

05/24/2018, 11:46 AM
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

albertgao

05/25/2018, 1:18 AM
@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

russhwolf

05/25/2018, 1:22 AM
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.