Discover your project

    When you , the Project Wizard automatically applies the Gradle plugin in the file build.gradle(.kts).

    You can also apply it manually.

    The 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.

    In the file build.gradle(.kts), it creates the kotlin extension at the top level, which includes configuration for targets, , and dependencies.

    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.

    Learn how to .

    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 main and test compilations of the common code and all added targets.

    Source set names are case sensitive.

    Source sets are added to the block of the top-level kotlin block.

    For example, all Kotlin/Native features are available in the desktopMain source set, which targets the Linux (linuxX64), Windows (mingwX64), and macOS (macosX64) platforms.

    Hierarchical structure

    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:

    • A compilation per , for Android targets.

    Learn how to configure compilations.