Skip to main content

SDK setup for KMP apps

This guide sets up the Kotzilla SDK in your KMP app.

Not using Koin?

This guide assumes your app uses Koin. For Hilt, Metro, Dagger, or manual DI, see Setup with Hilt, Metro, or manual DI.

Before starting, your application must be registered on the Kotzilla Platform:

Once your app is registered and its type is selected, follow the steps below to add the SDK.

Step 1 - Setup Kotzilla SDK (KMP)​

1.1 Kotzilla project configuration file​

Download the kotzilla.json configuration file for your shared module and place it in the module directory:

Module (shared module) Gradle file: <project>/<shared-module>

This file contains your API key, version, and SDK configuration for shared code.

note

For KMP projects, open the downloaded kotzilla.json and add "isDefault": true to the key entry. See Using the isDefault property for details.

For Koin apps

Place kotzilla.json in the shared module, which owns the configuration (key, site and version). iOS and other targets are instrumented through it. Apps that do not use Koin follow a different rule, see Setup with Hilt, Metro, or manual DI.

1.2 Set up the SDK​

The instructions below use Version Catalog configuration by default.

If your project uses the legacy Gradle setup, see the legacy Gradle setup instructions.

note

The Kotzilla SDK is available on Maven Central and on the Kotzilla public repository. To use the Kotzilla repository, see Kotzilla repository access.

Add the following lines to your libs.versions.toml file:

[versions]
kotzilla = "3.0.1" // Check the latest version available below

[libraries]
kotzilla-sdk = { group = "io.kotzilla", name = "kotzilla-sdk", version.ref = "kotzilla" }

[plugins]
kotzilla = { id = "io.kotzilla.kotzilla-plugin", version.ref = "kotzilla" }
info

The latest version of the kotzilla-sdk is: Maven Central

Set up the Kotzilla Plugin in your project root-level Gradle file (<project>/build.gradle.kts):

plugins {
alias(libs.plugins.kotzilla) apply true
}

In your shared module Gradle file (<project>/<shared-module>/build.gradle.kts), add:

plugins {
alias(libs.plugins.kotzilla)
}

kotzilla {
versionName = "1.0.0" // Your app version
}

The plugin's root-level apply already covers your Android application module, so crashes from minified release builds are deobfuscated. See Mapping files.

Auto-Dependency Injection

The SDK dependency is automatically added to commonMain. You don't need to add an implementation line.

To manage it yourself, set kotzilla { autoAddDependencies = false }, then add:

commonMain.dependencies {
implementation(libs.kotzilla.sdk)
}
All plugin options

The kotzilla {} block supports more options (composeInstrumentation, autoAddDependencies, uploadMappingFile, and others). See Kotzilla Gradle plugin configuration for the full reference.

1.3 Supported Platforms​

The Kotzilla SDK supports these KMP targets:

PlatformTargetStatusNotes
AndroidandroidTarget()StableFull crash reporting with mapping file support
iOSiosArm64(), iosX64(), iosSimulatorArm64()StabledSYM setup required for crash symbolication
JVMjvm()StableCrash reporting works; no mapping file support yet

For Compose Multiplatform (which adds JS/WASM browser targets), see CMP Setup.

1.4 Sync Gradle​

Sync your project in Android Studio or IntelliJ IDEA to apply the changes.

Build report

Builds print the Kotzilla report for the selected app version. By default, a FAIL status does not block the build: the report is for information. To make a FAIL status fail the build, set kotzilla { skipBuildReportFailure = false }, or override it per build from CI/CD with -Pkotzilla.skipBuildReportFailure=false. See Kotzilla Gradle plugin configuration for details.

1.5 iOS Platform Support​

iOS Build Configuration​

Your shared module's build.gradle.kts should already include iOS targets:

kotlin {
// iOS targets
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "SharedModule" // Your shared module name
isStatic = true
}
}

// Other KMP targets
androidTarget()
// ... jvm, etc.
}

The Kotzilla SDK is included in your iOS framework automatically when you build for iOS targets.

Xcode Integration​

When integrating the shared KMP module into your Xcode project:

The Kotzilla SDK is embedded in your shared framework, so iOS needs no extra configuration: data is collected automatically when the app runs on iOS.

For framework generation, use Gradle tasks like:

Debug builds:

./gradlew linkDebugFrameworkIosSimulatorArm64
./gradlew linkDebugFrameworkIosArm64
./gradlew linkDebugFrameworkIosX64

Release builds:

./gradlew linkReleaseFrameworkIosSimulatorArm64
./gradlew linkReleaseFrameworkIosArm64
./gradlew linkReleaseFrameworkIosX64

1.6 iOS Crash Reporting​

The SDK captures iOS crashes automatically using PLCrashReporter, including the full Kotlin stack trace. For readable crash reports, dSYM upload is required.

iOS Crashes Unreadable Without dSYM

Without the correct dSYM file, iOS crash reports show only memory addresses, with no function names, file names or line numbers.

One-Time Setup​

Run this command to inject the dSYM upload script into your Xcode project:

./gradlew setupKotzillaXcode

Re-run after SDK updates to refresh the embedded script.

How It Works​

  1. When the app crashes, the crash data is saved on the device.
  2. When the app relaunches, the crash report is uploaded to Kotzilla.
  3. Kotzilla matches it with the dSYM, and the readable stack trace appears in the Console.

Manual dSYM Upload​

If automatic upload fails:

./gradlew uploadDsymFile

Version Consistency Warning​

Don't Override Production dSYMs

Each version can only have one dSYM file. If you rebuild the same version, the new dSYM overwrites the previous one, making older crashes unreadable.

Avoid these mistakes:

  • Rebuilding a released version and uploading its dSYM (overwrites production dSYM)
  • Using the same version for both debug and release builds

Always increment your version for each release build, including hotfixes.

Disable iOS Crash Reporting (Optional)​

monitoring {
onConfig { useIosCrashReport = false }
}

1.7 JVM Target Support​

For JVM-only projects (Desktop apps, backend services), add the JVM target:

kotlin {
jvm() // Desktop/server target
androidTarget()
// ... other targets
}

The SDK captures crashes and analytics on JVM with no additional configuration.

JVM Crash Reporting Limitations

Mapping file support is not yet available for JVM. If you use obfuscation (for example ProGuard), stack traces will show obfuscated names.

Step 2 - Start Kotzilla SDK (KMP)​

Initialize the Kotzilla SDK in the Koin configuration of your shared module (Koin.kt in commonMain):

import io.kotzilla.generated.monitoring

startKoin {
// Your current Koin configuration
..
// Add Kotzilla monitoring
monitoring()
}
info

The monitoring() function is generated at build time by the Kotzilla Gradle plugin. It reads the API key and configuration from your kotzilla.json file automatically.

Call monitoring() last inside the startKoin { ... } block, after any modules(...) and includes(...) declarations, to avoid initialization issues.

note

Place startKoin { ... } in your shared code and call it once from each platform's entry point (Application.onCreate() on Android, AppDelegate on iOS), not from a composable.

Step 3 - Go To Dashboard​

Now that the SDK is configured, you can build and run your app to start capturing data from a first user session.

Once you've stopped the app:

  • Click Check your data to confirm everything is being collected correctly.
  • Then click Go to Dashboard to see your app's performance and configuration.
info

Questions or issues during setup? Contact us.

The Kotzilla MCP Server can also guide your setup and analyze issues from your AI coding assistant.