Kotlin Multiplatform Help

Kotlin Multiplatform quickstart

In this tutorial, you'll learn how to build and run a simple Kotlin Multiplatform app with a Compose Multiplatform UI.

Set up the environment

Start with an IDE and necessary plugins:

  1. Choose and install the IDE: Kotlin Multiplatform is fully supported in IntelliJ IDEA and Android Studio.

    The JetBrains Toolbox App is the recommended tool to install IDEs. It allows you to manage multiple products or versions, including Early Access Program (EAP) and Nightly releases.

    For standalone installations, download the installer for IntelliJ IDEA or Android Studio.

    The plugins necessary for Kotlin Multiplatform require at least IntelliJ IDEA 2025.2.2 or Android Studio Otter 2025.2.1.

  2. Install the Kotlin Multiplatform IDE plugin.

    The IDE plugin also installs any necessary dependencies your IDE does not have yet.

  3. If you don't have the ANDROID_HOME environment variable set, configure your system to recognize it:

    Add the following command to your .profile or .zprofile:

    export ANDROID_HOME=~/Library/Android/sdk

    For PowerShell, you can add a persistent environment variable with the following command (see PowerShell docs for details):

    [Environment]::SetEnvironmentVariable('ANDROID_HOME', '<path to the SDK>', 'Machine')

    For CMD, use the setx command:

    setx ANDROID_HOME "<path to the SDK>"
  4. To create iOS applications, you need a macOS host with Xcode installed. Your IDE will run Xcode under the hood to build iOS frameworks.

    Make sure to launch Xcode at least once before starting to work with KMP projects so that it goes through the initial setup.

Create a project

Use the IDE wizard to create a new KMP project:

  1. Select File | New | Project in the main menu.

  2. Choose Kotlin Multiplatform in the list on the left.

  3. Set the name, location, and other base attributes of the project as needed.

  4. We recommend selecting a version of JetBrains Runtime (JBR) as the JDK for your project, as it provides important fixes, particularly for improving the compatibility of desktop KMP apps. Relevant versions of JBR are included in every IntelliJ IDEA distribution, so no additional setup is required.

  5. To create a full demo, choose all available platforms: Android, iOS, Desktop, Web, and Server. Leave Share UI options selected where they are available to use Compose Multiplatform as the UI framework for the corresponding target.

  6. When you've chosen your platforms, click the Create button and wait for the IDE to generate and import the project.

IntelliJ IDEA Wizard with default settings and Android, iOS, desktop, and web platforms selected

Use the IDE wizard to create a new KMP project:

  1. Select File | New | New project in the main menu.

  2. Choose Kotlin Multiplatform in the default Phone and Tablet template category.

    First new project step in Android Studio
  3. Set the name, location, and other base attributes of the project as needed, then click Next.

  4. To create a full demo, choose all available platforms: Android, iOS, Desktop, Web, and Server. Leave Share UI options selected where they are available to use Compose Multiplatform as the UI framework for the corresponding target.

  5. When you've chosen your platforms, click the Finish button and wait for the IDE to generate and import the project.

Last step in the Android Studio wizard with Android, iOS, desktop, and web platforms selected

Consult the preflight checks

You can make sure there are no environment issues with the project setup by opening the Project Environment Preflight Checks tool window: click the preflight checks icon on the right sidebar or the bottom bar Project Environment Preflight Checks icon with a plane

In this tool window, you can see messages related to these checks, rerun them, or change their settings.

Preflight checks commands are also available in the Search Everywhere dialog. Press double Shift and search for commands containing the word "preflight":

The Search Everywhere menu with the word "preflight" entered

Run the sample apps

The project created by the IDE wizard includes generated run configurations for iOS, Android, desktop, and web applications, as well as Gradle tasks for running the server app. The specific Gradle commands for each platform are listed below.

To run the Android app, start the composeApp run configuration:

Dropdown with the Android run configuration highlighted

To create an Android run configuration manually, choose Android App as the run configuration template and select the module [project name].composeApp.

By default, it runs on the first available virtual device:

Android app ran on a virtual device

If you chose the iOS target for the project and set up a macOS machine with Xcode, you can choose the iosApp run configuration and select a simulated device:

Dropdown with the iOS run configuration highlighted

When you run the iOS app, it is built with Xcode under the hood and launched in the iOS Simulator. The very first build collects native dependencies for compilation and warms up the build for subsequent runs:

iOS app ran on a virtual device

The default run configuration for a desktop app is created as composeApp [desktop]:

Dropdown with the default desktop run configuration highlighted

To create a desktop run configuration manually, choose a Gradle run configuration template and point to the [app name]:composeApp Gradle project with the following command:

desktopRun -DmainClass=com.example.myapplication.MainKt --quiet

With this configuration you can run the JVM desktop app:

JVM app ran on a virtual device

The default run configuration for a web app is created as composeApp [wasmJs]:

Dropdown with the default Wasm run configuration highlighted

To create a web run configuration manually, choose a Gradle run configuration template and point to the [app name]:composeApp Gradle project with the following command:

wasmJsBrowserDevelopmentRun

When you run this configuration, the IDE builds the Kotlin/Wasm app and opens it in the default browser:

Web app ran on a virtual device

Troubleshooting

Java and JDK

Common issues with Java:

  • Some tools may not find a Java version to run or use a wrong version. To solve this:

    • Set the JAVA_HOME environment variable to the directory where the appropriate JDK is installed.

    • Append the path to the bin folder inside your JAVA_HOME to the PATH variable, so that the tools included in JDK are available in the terminal.

  • If you encounter issues with Gradle JDK in Android Studio, make sure it's configured correctly: select Settings | Build, Execution, Deployment | Build Tools | Gradle.

Android tools

Same as for JDK, if you have trouble launching Android tools like adb, make sure paths to ANDROID_HOME/tools, ANDROID_HOME/tools/bin, and ANDROID_HOME/platform-tools are added to your PATH environment variable.

Xcode

If your iOS run configuration reports that there is no virtual device to run on, or the preflight check fails, make sure to launch Xcode and see if there are any updates for the iOS simulator.

Get help

What's next

Learn more about the structure of a KMP project and writing shared code:

Discover code already written for KMP:

  • Our Samples page, with official JetBrains samples as well as a curated list of projects showcasing KMP capabilities.

  • The GitHub topics:

  • klibs.io – search platform for KMP libraries, with more than 2000 libraries indexed so far, including OkHttp, Ktor, Coil, Koin, SQLDelight, and others.

01 April 2026