|
| 1 | +--- |
| 2 | +title: Manual Setup |
| 3 | +sidebar_order: 1 |
| 4 | +description: "Learn how to set up the SDK manually." |
| 5 | +--- |
| 6 | + |
| 7 | +If you can't (or prefer not to) run the [automatic setup](/platforms/kotlin-multiplatform/#install), you can follow the instructions below to configure your application manually. |
| 8 | + |
| 9 | +## Install |
| 10 | + |
| 11 | +Sentry captures data by using an SDK within your application’s runtime. |
| 12 | + |
| 13 | +To install the Kotlin Multiplatform SDK, you need to add the following to your `build.gradle.kts` file in your shared module: |
| 14 | + |
| 15 | +```kotlin {filename:shared/build.gradle.kts} |
| 16 | +plugins { |
| 17 | + kotlin("multiplatform") |
| 18 | + kotlin("native.cocoapods") |
| 19 | + // .. your other plugins |
| 20 | +} |
| 21 | + |
| 22 | +kotlin { |
| 23 | + android() |
| 24 | + iosX64() |
| 25 | + iosArm64() |
| 26 | + iosSimulatorArm64() |
| 27 | + |
| 28 | + sourceSets { |
| 29 | + val commonMain by getting { |
| 30 | + dependencies { |
| 31 | + implementation("io.sentry:sentry-kotlin-multiplatform:{{@inject packages.version('sentry.kotlin.kmp', '0.0.1-alpha.2') }}") |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + // Android target |
| 36 | + val androidMain by getting { |
| 37 | + dependsOn(commonMain) |
| 38 | + } |
| 39 | + |
| 40 | + // Apple targets: |
| 41 | + val iosMain by getting { |
| 42 | + dependsOn(commonMain) |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + cocoapods { |
| 47 | + summary = "Some description for the Shared Module" |
| 48 | + homepage = "Link to the Shared Module homepage" |
| 49 | + ios.deploymentTarget = "14.1" |
| 50 | + podfile = project.file("../iosApp/Podfile") |
| 51 | + // Make sure you use the proper version according to our Cocoa SDK Version Compatibility Table. |
| 52 | + pod("Sentry") { |
| 53 | + version = "~> 8.25" |
| 54 | + linkOnly = true |
| 55 | + extraOpts += listOf("-compiler-option", "-fmodules") |
| 56 | + } |
| 57 | + framework { |
| 58 | + baseName = "shared" |
| 59 | + } |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +## Configure |
| 65 | + |
| 66 | +Configuration should happen as early as possible in your application's lifecycle. |
| 67 | + |
| 68 | +<PlatformContent includePath="getting-started-config" /> |
| 69 | + |
| 70 | +## Verify |
| 71 | + |
| 72 | +This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. |
| 73 | + |
| 74 | +<PlatformContent includePath="getting-started-verify" /> |
| 75 | + |
| 76 | +<Note> |
| 77 | + |
| 78 | +Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>. |
| 79 | + |
| 80 | +</Note> |
| 81 | + |
| 82 | +To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. |
| 83 | + |
| 84 | +## Apple Installation Methods |
| 85 | + |
| 86 | +### Swift Package Manager (SPM) |
| 87 | + |
| 88 | +Swift Package Manager (SPM) is a powerful tool for managing dependencies in Swift that allows developers to enjoy a more native integration experience with Xcode. |
| 89 | +If you already use SPM or prefer it over other package managers on Apple platforms, this guide will show you how to install the Kotlin Multiplatform SDK while using Swift Package Manager. |
| 90 | + |
| 91 | +#### Install |
| 92 | + |
| 93 | +In order to install the Sentry Kotlin Multiplatform SDK, you need to use Cocoapods and Swift Package Manager simultaneously which might seem unconventional at first, especially if you're accustomed to using SPM for all your dependencies. However, you can achieve a smooth integration by using the Kotlin Cocoapods plugin specifically for compiling and building the shared framework. You can then continue to manage all other dependencies with SPM as usual. |
| 94 | + |
| 95 | +Follow the steps for our primary installation method [Cocoapods](/platforms/kotlin-multiplatform/manual-setup/#install) to install the Sentry Kotlin Multiplatform SDK. |
| 96 | + |
| 97 | +After you've consumed the shared framework in your application via Cocoapods, you can continue with SPM for other dependencies without disrupting your existing workflow. |
0 commit comments