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

Christopher Elías

09/16/2020, 4:55 PM
Hello 👋! Can I start a Kotlin MMP for Android & iOS with Android Studio on Windows? Does anybody have some samples on how to prepare the environment and "hello world sample" maybe?
s

Sam

09/16/2020, 5:04 PM
The only problem you’ll have is working with iOS specific code as that requires a Mac. Anything that is Android or common code should be fine.
c

Christopher Elías

09/16/2020, 5:55 PM
Thanks for the reply Sam. So limitating and frustrating btw. So the only option is to get a Mac for anybody who want to develop native apps with shared common code
j

James Palawaga

09/16/2020, 6:02 PM
You can develop native apps with shared common code (Windows Native, JVM, even iOS) but you will not be able to compile iOS/mac targets without a mac
👍 1
so if you write a KN/MPP app, it could potentially have a valid iOS target, you just have no way of actually compiling it without a mac (it’s an apple thing rather than a kotlin thing)
👍 1
c

Christopher Elías

09/16/2020, 6:09 PM
Thanks James! Very clear response. I have some doubts as I am literally new into Multiplatform and you seem to have experience with it, which IDE do you use for it or probably do you have to work with multiple IDEs at the time (for android (A.S), ios (XCode) and common (Intelli J)? How does that work?
j

James Palawaga

09/16/2020, 6:12 PM
I actually work mostly on a shared KN library used by our platforms, so I do all of my development in Intellij as I’m only writing kotlin with no platforms. If I’m testing our library in a particular platform app, then I use the individual platform’s toolchains to build the app with our MPP lib (Android->AS, iOS->XCode, VS->Windows).
👍 1
I think a good starting point would be to make a simple
returnHello()
function in a KN library. and work on your gradle scripts to build the package for each platform. Then for each platform, work on consuming that
returnHello()
function. For JVM for example, you might want to means publishing your package to a local maven repo, or at the minimum publish the jar to a known location
👍 1
At least, this is how we use KN. I’m not sure about, say, using react native to make up the UI, and then publishing an app entirely from KN. I suspect you’ll still need to use each platform’s build toolchains (XCode, AS, VS) at the minimum to bootstrap your KN project, but this is out of my area of expertise.
👍 1
c

Christopher Elías

09/16/2020, 6:49 PM
Thanks for your help James! I will continue the investigation and see how far can I go with it on my laptop (Windows OS).
a

Andrew

09/16/2020, 7:45 PM
What is your android experience at the moment?
c

Christopher Elías

09/16/2020, 8:06 PM
3-5 years... why?
a

Andrew

09/16/2020, 8:51 PM
KMP is mostly about code sharing, so the best you can do without a mac is move as much code in an existing android app to a shared KMP library. It will require some re-architecture and some less than ideal design decisions than if it was a 100% android app. That is about as close as you can get to the multiplatform part without having access to the other platform.
👍🏿 1
👍 1
c

Christopher Elías

09/16/2020, 9:09 PM
Thanks, I will have in mind that advice!
2 Views