> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revyl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin Multi-platform (KMP)

> Run the dev loop on a KMP project

KMP projects share business logic in Kotlin across iOS and Android while building native binaries for each platform. Revyl detects the KMP layout and routes you into the rebuild-based dev loop using native iOS and Android build commands underneath.

The CLI detects KMP projects by looking for a `shared` module alongside native shell directories (`iosApp`, `androidApp`, or `composeApp`) and KMP-specific Gradle markers. It generates `build.platforms.ios` and `build.platforms.android` entries using the underlying native build systems (Xcode for iOS, Gradle for Android).

KMP does not have its own hot reload runtime. The dev loop uses the same rebuild model as native iOS/Android: press `[r]` to rebuild the full binary including shared Kotlin code, upload it, and reinstall.

### What `revyl init` shows

When KMP is detected, the CLI explains the mapping:

```
Detected: Kotlin Multiplatform
  Shared module: shared/
  Platforms: ios, android
  Note: Shared KMP logic compiles into native iOS/Android binaries.
        The dev loop uses native build commands underneath.
```

### Manual configuration

If auto-detection does not trigger (e.g. a non-standard project layout), configure the native builds manually:

```yaml theme={null}
build:
  system: Kotlin Multiplatform
  platforms:
    ios:
      commands:
        - "cd shared && ./gradlew assemble"
        - "cd iosApp && xcodebuild -workspace iosApp.xcworkspace -scheme iosApp -configuration Debug -sdk iphonesimulator -derivedDataPath build"
      output: "iosApp/build/Build/Products/Debug-iphonesimulator/*.app"
    android:
      command: "cd androidApp && ./gradlew assembleDebug"
      output: "androidApp/build/outputs/apk/debug/androidApp-debug.apk"
```

Use `commands` for ordered local rebuild steps. Use singular `command` when the
platform only needs one shell command.
