Compose

Introduction

IntelliJ IDEA provides full Kotlin Multiplatform support. Android Studio is another stable solution for Kotlin Multiplatform. Since both are built on the IntelliJ platform, they generally share the same features. However, specific updates may not be released simultaneously.

You can install the Kotlin Multiplatform IDE plugin that provides basic launching and debugging capabilities for iOS apps, preflight environment checks, and other helpful KMP functionality.

Apart from base Kotlin Multiplatform features, the plugin also provides support for Compose Multiplatform libraries, enabling more comfortable UI development:

  • Quality-of-life automation for multiplatform resources.
  • Support for the @Preview annotation which works in common Compose code.
  • Support for Compose Hot Reload, including automatic detection of hot reload run configurations, IDE integration with logs and settings, and tailored IDE actions and toolbars to make the overall experience smoother.

Xcode

If you’re targeting iOS in your Kotlin Multiplatform project, you need Xcode installed on your machine to write iOS-specific code and run iOS applications.

To upload your apps to App Store Connect, build them with Xcode 16 or later.

Quick Start

Quick Start

Install the Kotlin Multiplatform IDE plugin (not to be confused with the Kotlin Multiplatform Gradle plugin).

Installing the Kotlin Multiplatform IDE plugin for IntelliJ IDEA also installs all necessary dependencies if you don’t have them yet (Android Studio has all necessary plugins bundled).

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:

Terminal window
export ANDROID_HOME=~/Library/Android/sdk

To create iOS applications, you need a macOS host with [Xcode(https://apps.apple.com/us/app/xcode/id497799835) 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.

Note

You will need to launch Xcode manually every time it is updated and download the updated tooling. The Kotlin Multiplatform IDE plugin makes preflight checks that alert you whenever Xcode is not in the right state to work with.

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 Preflight checks icon with a plane

In this tool window, you can see the 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”:

Run

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.

Android

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

TODO image 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:

iOS

Note

You need a macOS host to build iOS apps.

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:

TODO image

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:

Recommended IDEs and code editors