$npx -y skills add getsentry/sentry-for-ai --skill sentry-android-sdkFull Sentry SDK setup for Android. Use when asked to "add Sentry to Android", "install sentry-android", "setup Sentry in Android", or configure error monitoring, tracing, profiling, session replay, or logging for Android applications. Supports Kotlin and Java codebases.
| 1 | > [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > Android SDK |
| 2 | |
| 3 | # Sentry Android SDK |
| 4 | |
| 5 | Opinionated wizard that scans your Android project and guides you through complete Sentry setup — error monitoring, tracing, profiling, session replay, logging, and more. |
| 6 | |
| 7 | ## Invoke This Skill When |
| 8 | |
| 9 | - User asks to "add Sentry to Android" or "set up Sentry" in an Android app |
| 10 | - User wants error monitoring, crash reporting, ANR detection, tracing, profiling, session replay, or logging in Android |
| 11 | - User mentions `sentry-android`, `io.sentry:sentry-android`, mobile crash tracking, or Sentry for Kotlin/Java Android |
| 12 | - User wants to monitor native (NDK) crashes, application not responding (ANR) events, or app startup performance |
| 13 | |
| 14 | > **Note:** SDK versions and APIs below reflect current Sentry docs at time of writing (`io.sentry:sentry-android:8.33.0`, Gradle plugin `6.1.0`). |
| 15 | > Always verify against [docs.sentry.io/platforms/android/](https://docs.sentry.io/platforms/android/) before implementing. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Phase 1: Detect |
| 20 | |
| 21 | Run these commands to understand the project before making any recommendations: |
| 22 | |
| 23 | ```bash |
| 24 | # Detect project structure and build system |
| 25 | ls build.gradle build.gradle.kts settings.gradle settings.gradle.kts 2>/dev/null |
| 26 | |
| 27 | # Check AGP version and existing Sentry |
| 28 | grep -r '"com.android.application"' build.gradle* app/build.gradle* 2>/dev/null | head -3 |
| 29 | grep -ri sentry build.gradle* app/build.gradle* 2>/dev/null | head -10 |
| 30 | |
| 31 | # Check app-level build file (Groovy vs KTS) |
| 32 | ls app/build.gradle app/build.gradle.kts 2>/dev/null |
| 33 | |
| 34 | # Detect Gradle version catalog (libs.versions.toml) — modern AGP projects |
| 35 | ls gradle/libs.versions.toml 2>/dev/null |
| 36 | |
| 37 | # Check for existing Sentry entries in the version catalog |
| 38 | grep -iE 'sentry|io\.sentry' gradle/libs.versions.toml 2>/dev/null | head -10 |
| 39 | |
| 40 | # Check if build files reference the catalog (alias/libs.* usage) |
| 41 | grep -E 'alias\(libs\.|libs\.[a-zA-Z]' build.gradle build.gradle.kts app/build.gradle app/build.gradle.kts 2>/dev/null | head -5 |
| 42 | |
| 43 | # Detect Kotlin vs Java |
| 44 | find app/src/main -name "*.kt" 2>/dev/null | head -3 |
| 45 | find app/src/main -name "*.java" 2>/dev/null | head -3 |
| 46 | |
| 47 | # Check minSdk, targetSdk |
| 48 | grep -E 'minSdk|targetSdk|compileSdk|minSdkVersion|targetSdkVersion' app/build.gradle app/build.gradle.kts 2>/dev/null | head -6 |
| 49 | |
| 50 | # Detect Jetpack Compose |
| 51 | grep -E 'compose|androidx.compose' app/build.gradle app/build.gradle.kts 2>/dev/null | head -5 |
| 52 | |
| 53 | # Detect OkHttp (popular HTTP client — has dedicated integration) |
| 54 | grep -E 'okhttp|retrofit' app/build.gradle app/build.gradle.kts 2>/dev/null | head -3 |
| 55 | |
| 56 | # Detect Room or SQLite |
| 57 | grep -E 'androidx.room|androidx.sqlite' app/build.gradle app/build.gradle.kts 2>/dev/null | head -3 |
| 58 | |
| 59 | # Detect Timber (logging library) |
| 60 | grep -E 'timber' app/build.gradle app/build.gradle.kts 2>/dev/null | head -3 |
| 61 | |
| 62 | # Detect Jetpack Navigation |
| 63 | grep -E 'androidx.navigation' app/build.gradle app/build.gradle.kts 2>/dev/null | head -3 |
| 64 | |
| 65 | # Detect Apollo (GraphQL) |
| 66 | grep -E 'apollo' app/build.gradle app/build.gradle.kts 2>/dev/null | head -3 |
| 67 | |
| 68 | # Check existing Sentry initialization |
| 69 | grep -r "SentryAndroid.init\|io.sentry.Sentry" app/src/ 2>/dev/null | head -5 |
| 70 | |
| 71 | # Check Application class |
| 72 | find app/src/main -name "*.kt" -o -name "*.java" 2>/dev/null | xargs grep -l "Application()" 2>/dev/null | head -3 |
| 73 | |
| 74 | # Adjacent backend (for cross-linking) |
| 75 | ls ../backend ../server ../api 2>/dev/null |
| 76 | find .. -maxdepth 2 \( -name "go.mod" -o -name "requirements.txt" -o -name "Gemfile" \) 2>/dev/null | grep -v node_modules | head -5 |
| 77 | ``` |
| 78 | |
| 79 | **What to determine:** |
| 80 | |
| 81 | | Question | Impact | |
| 82 | |----------|--------| |
| 83 | | `build.gradle.kts` present? | Use Kotlin DSL syntax in all examples | |
| 84 | | `gradle/libs.versions.toml` present? | Add Sentry to the version catalog; reference via `libs.*` in build files | |
| 85 | | Catalog already has `sentry` entries? | Reuse the existing version ref; don't duplicate or hardcode versions | |
| 86 | | `minSdk < 26`? | Note Session Replay requires API 26+ — silent no-op below that | |
| 87 | | Compose detected? | Recommend `sentry-compose-android` and Compose-specific masking | |
| 88 | | OkHttp present? | Recommend `sentry-okhttp` interceptor or Gradle plugin bytecode auto-instrumentation | |
| 89 | | Room/SQLite present? | Recommend `sentry-android-sqlite` or plugin bytecode instrumentation | |
| 90 | | Timber present? | Recommend `sentry-android-timber` integration | |
| 91 | | Jetpack Navigation? | Recommend `sentry-android-navigation` for screen tracking | |
| 92 | | Already has `SentryAndroid.init()`? | Skip install, jump to feature config | |
| 93 | | Application subclass exists? | That's where `SentryAndroid.init()` goes | |
| 94 | |
| 95 | --- |
| 96 | |
| 97 | ## Phase 2: Rec |