---
title: Hello (Kotlin Multiplatform) World
url: https://calvin.my/posts/hello-kotlin-multiplatform-world
published: 2024-06-30
updated: 2026-09-17
category: Development
tags:
- Kotlin
- KMP
- Android
- iOS
summary: This introductory Kotlin Multiplatform project targets Android and iOS to explore shared mobile development. The post outlines installing the Android Studio plugin, generating a project from a template, reviewing its platform-specific and common directories, and running both app configurations. After resolving an iOS build environment issue, the author modifies the shared Compose interface and confirms the change on both platforms. Xcode remains necessary for building, running, and packaging iOS apps.
---

# Hello (Kotlin Multiplatform) World

This is my first hands-on project using [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) technology.

It supports mobile (iOS, Android), web, desktop (windows, Linux, Mac), and backend, but for learning's sake, I will try just iOS and Android.

* * *

## Where should I start?

1. The recommended IDE is Android Studio. First, we need to install the JetBrains Multiplatforms plugin.

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/48fbcfd5-beeb-458e-98e3-843d8bee72c4.png)

2. To create a multiplatform project, you can create a new project via the Android Studio template. Or go to [https://kmp.jetbrains.com/](https://kmp.jetbrains.com/) to fill up a form and download the code template.

   **Option 1:**

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/edc33979-e55a-4332-a6ff-dea33a0a8a68.png)

   **Option 2:**

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/dfabd851-2590-4114-85b8-5a2855e436f3.png)

* * *

## What's next?

1. Wait for the gradle sync to complete. Now you should be able to see the project directory. There is an Android directory, an iOS directory, and a common.&nbsp;

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/755d9a81-8d43-4a08-97c8-92d624d43f12.png)

2. We can also check the Run configurations, there are 2 apps.

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/26e71b1e-cdbb-41c2-9a2c-aaf57f885585.png)

3. Let's run both app and see what happens.

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/798503b6-aaa1-4d22-b9c8-05e00127b6b3.png)

4. Before the previous step worked, I encountered an issue when trying to build the iOS app.&nbsp;

   ```markup
   Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
   ```

   This is due to the development environment setup on my laptop. It can be solved by specifying the Java Path in gradle.properties

   ```bash
   org.gradle.java.home=/path/to/17
   ```

* * *

## Let's make some change

1. Head to App.kt where the compose UI is defined. Let's add a text label.

   ```kotlin
   var showContent by remember { mutableStateOf(false) }
   Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
       Button(onClick = { showContent = !showContent }) {
           Text("Click me!")
       }
       AnimatedVisibility(showContent) {
           val greeting = remember { Greeting().greet() }
           Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
               Image(painterResource(Res.drawable.compose_multiplatform), null)
               Text("Compose: $greeting")
               // New text
               Text("Woohoo! Calvin's First KMP App")
           }
       }
   }
   ```

2. Rebuild and run our app again. It works!

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/9b598e08-6d22-47a6-a4e8-44cc6beef431.png)

* * *

## Note

To build, run, and package the iOS app, you will still need XCode installed.
