Kotlin Multiplatform (KMP) project targeting Android and iOS, with a shared module and platform-specific app entry points.
This template provides a minimal structure for a Kotlin Multiplatform project:
- Shared module — Common and platform-specific Kotlin code (Android, iOS).
- Android app — Android application module (
androidApp). - iOS app — iOS application project (
iosApp).
| Module | Path | Description |
|---|---|---|
| shared | shared/ |
Shared KMP code. Main sources in shared/src/commonMain/kotlin. Platform code in androidMain, iosMain. |
| androidApp | androidApp/ |
Android application. Entry point and Android-specific UI. |
| iosApp | iosApp/ |
iOS application (Xcode project). Entry point and SwiftUI. |
- JDK 17
- Android Studio (Meerkat or later) or IntelliJ IDEA with Android and KMP support
- Xcode (for iOS builds)
- Gradle 9.4.0+ (wrapper included)
Optional: kdoctor to verify the KMP development environment.
Android
./gradlew :androidApp:assembleDebug
# Or run the androidApp configuration from the IDEiOS
Open iosApp/iosApp.xcodeproj in Xcode and run the app on a simulator or device.
Shared module (all targets)
./gradlew :shared:compileKotlinIosSimulatorArm64 :shared:compileAndroidMain./gradlew testWhen creating a new project from this template, update the following.
File: settings.gradle.kts
Set the root project name:
rootProject.name = "YourNewProjectName"File: androidApp/build.gradle.kts
Set the applicationId in the android { defaultConfig { ... } } block:
android {
defaultConfig {
applicationId = "com.yourcompany.yournewprojectname"
// ...
}
}File: iosApp/Configuration/Config.xcconfig
Update at least:
| Variable | Description | Example |
|---|---|---|
APP_ID |
Bundle ID | com.yourcompany.YourNewProjectName |
APP_NAME |
Display name | YourNewProjectName |
The shared module is set up for Maven publication via the gradle-maven-publish-plugin.
| Action | Command / Reference |
|---|---|
| Publish to local Maven | ./gradlew :shared:publishToMavenLocal |
| Publish to Maven Central | See docs/PUBLISHING.md for credentials and steps. |
Default coordinates: com.santimattius.kmp:shared:1.0.0-SNAPSHOT
To change groupId, artifactId, or version, edit the mavenPublishing { coordinates(...) } block in
shared/build.gradle.kts.
It is recommended to run kdoctor to check that your environment is correctly configured for Kotlin Multiplatform. kdoctor reports and can help fix common setup issues.
| Resource | URL |
|---|---|
| Kotlin Multiplatform — Get started | JetBrains Help |
| kdoctor | GitHub |
| Maven publishing (this project) | docs/PUBLISHING.md |