For developers interested in building Android and iOS apps with Kotlin Multiplatform (KMP), the first place to start is tools. In this blog post, we'll cover the 2 primary options for building KMP apps: Android Studio and IntelliJ IDEA Community Edition. Installing Android Studio is covered on Koko's startup framework ↗. This post will cover IntelliJ IDEA Community Edition.
Installing IntelliJ IDEA
As with all things KMP, there are a lot of options. The easiest way to get IntelliJ IDEA is:
- Install the Toolbox from https://www.jetbrains.com/products/ ↗
- Once installed, search for IntelliJ and choose the IntelliJ IDEA Community Edition (not the IntelliJ IDEA Ultimate).
If you want to avoid using the Toolbox and just install it directly, you can search for your download directly here: https://www.jetbrains.com/idea/download/other.html ↗
Getting Started with KMP
OLD SCHOOL: Once you have opened IntelliJ IDEA, create a new project using File -> New -> Project
and click on the "To create a KMP project click here"...or just visit kmp.jetbrains.com ↗.
RECOMMENDED: Install the Kotlin Multiplatform plugin by clicking
intelliJ IDEA -> Settings -> Plugins
and search for Kotlin Multiplatform. This will require a restart.
Once you have the KMP Plugin installed, you will see an option to create KMP projects directly within IntelliJ IDEA.
Even if you are only planning to build for Android and iOS, you may want to include Desktop in your project for Hot Reload - which we will cover next.
Hot Reload for Compose on Desktop
Here is a video describing hot reload - history and technical details. Worth a watch.
https://www.youtube.com/playlist?list=PLeFmP1PdcNbGTBE2c8dClJ_Sdsi_oQB43 ↗
And here is the Github Repo: https://github.com/JetBrains/compose-hot-reload ↗
Note that IntelliJ IDEA now includes hot reload in its default KMP projects automatically (if Desktop is selected) so you are not required to add the dependencies yourself.
Conclusion
JetBrains is making it easier to get up-and-running with KMP, by providing KMP templates directly within IntelliJ IDEA and by making those KMP templates support hot reload straight out of the box. Give it a shot and let me know what you think.