Discover your project
Discover main parts of your multiplatform project:
When you create a multiplatform project, the Project Wizard automatically applies the
kotlin-multiplatform Gradle plugin in the file
You can also apply it manually.
kotlin-multiplatform plugin configures the project for creating an application or library to work on multiple platforms and prepares it for building on these platforms.
A multiplatform project is aimed at multiple platforms that are represented by different targets. A target is part of the build that is responsible for building, testing, and packaging the application for a specific platform, such as macOS, iOS, or Android. See the list of supported platforms.
When you create a multiplatform project, targets are added to the
kotlin block in the file
Learn how to set up targets manually.
The project includes the directory
src with Kotlin source sets, which are collections of Kotlin code files, along with their resources, dependencies, and language settings. A source set can be used in Kotlin compilations for one or more target platforms.
Each source set directory includes Kotlin code files (the
kotlin directory) and
resources. The Project Wizard creates default source sets for the
test compilations of the common code and all added targets.
Source sets are added to the
sourceSets block of the top-level
Source sets form a hierarchy, which is used for sharing the common code. In a source set shared among several targets, you can use the platform-specific language features and dependencies that are available for all these targets.
For example, all Kotlin/Native features are available in the
desktopMain source set, which targets the Linux (
linuxX64), Windows (
mingwX64), and macOS (
Learn how to build the hierarchy of source sets.
Each target can have one or more compilations, for example, for production and test purposes.
For each target, default compilations include:
testcompilations for JVM, JS, and Native targets.
A compilation per Android build variant, for Android targets.
Each compilation has a default source set, which contains sources and dependencies specific to that compilation.
Learn how to configure compilations.