Before you create your first Kotlin Multiplatform application, you need to set up an environment for KMP development.
We recommend that you install the latest stable versions for compatibility and better performance.
Tool | Comments |
Android Studio | You will use Android Studio to create your multiplatform applications and run them on simulated or hardware devices. |
Xcode is required if you want to run iOS applications on a simulated or real device. If you use a different operating system, skip this tool. |
Launch Xcode in a separate window to accept its license terms and allow it to perform some necessary initial tasks. Most of the time, Xcode will work in the background. You will use it to add Swift or Objective-C code to your iOS application. We generally recommend using the latest stable versions for all tools. However, Kotlin/Native sometimes doesn't support the newest Xcode right away. You can check supported versions in the compatibility guide, and if necessary, install an earlier version of Xcode. |
JDK | To check whether Java is installed, run the following command in the Android Studio terminal or your command line: java -version |
Kotlin Multiplatform plugin | In Android Studio, open Settings (Preferences) and find the Plugins page. Search the Marketplace tab for Kotlin Multiplatform, and then install it. |
Kotlin plugin |
The Kotlin plugin is bundled and automatically updated with each Android Studio release. |
To make sure everything works as expected, install and run the KDoctor tool:
KDoctor works on macOS only. If you use a different operating system, skip this step.
{style="note"}
-
In the Android Studio terminal or your command-line tool, run the following command to install the tool using Homebrew:
brew install kdoctor
If you don't have Homebrew yet, install it or see the KDoctor README for other ways to install it.
-
After the installation is completed, call KDoctor in the console:
kdoctor
-
If KDoctor diagnoses any problems while checking your environment, review the output for issues and possible solutions:
- Fix any failed checks (
[x]
). You can find problem descriptions and potential solutions after the*
symbol. - Check the warnings (
[!]
) and successful messages ([v]
). They may contain useful notes and tips, as well.
You may ignore KDoctor's warnings regarding the CocoaPods installation. In your first project, you will use a different iOS framework distribution option.
{style="tip"}
- Fix any failed checks (
Kotlin not configured
error. It's a known issue in Android Studio Giraffe 2022.3 that doesn't affect building and running projects. To avoid the error, click Ignore or upgrade to Android Studio Hedgehog 2023.1.JAVA_HOME
. This environment variable specifies the location of the Java binary required for Xcode and Gradle. If so, follow KDoctor's tips to fix the issues.You may encounter Error: can't grab Xcode schemes
or other issues regarding command line tools selection. In this case, do one of the following:
In Terminal, run:
sudo xcode-select --switch /Applications/Xcode.app
Make sure that the path to Xcode.app
is selected. Confirm the action in a separate window if required.
Kotlin Multiplatform plugin
Kotlin plugin
Make sure that the Kotlin plugin is updated to the latest version. To do that, on the Android Studio welcome screen, select Plugins | Installed. Click Update next to Kotlin.
Make sure you have all the necessary tools installed:
command not found: brew
— install Homebrew.command not found: java
— install Java.Share your problems with the team by creating a YouTrack issue.
For a smoother multiplatform experience, you can also try JetBrains Fleet: it integrates with Compose Multiplatform and allows writing Swift code without switching to Xcode, with less IDE juggling overall.
- Kotlin Slack. Get an invite and join the #multiplatform channel.
- Kotlin issue tracker. Report a new issue.