|
| 1 | +# Sentry Sample Android App |
| 2 | + |
| 3 | +Sample application demonstrating how to use the Sentry Android SDK, including core functionality (error reporting, tracing, session replay, |
| 4 | +profiling) and integrations (Compose, OkHttp, SQLDelight, etc.). |
| 5 | + |
| 6 | +## How to run it? |
| 7 | + |
| 8 | +Install the app on your device or emulator: |
| 9 | + |
| 10 | +``` |
| 11 | +./gradlew :sentry-samples:sentry-samples-android:installDebug |
| 12 | +``` |
| 13 | + |
| 14 | +or simply open the project in Android Studio and run the `sentry-samples-android` configuration. |
| 15 | + |
| 16 | +You can also apply the [Sentry Android Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) (SAGP) when building (not applied by default): |
| 17 | + |
| 18 | +``` |
| 19 | +./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp=true |
| 20 | +``` |
| 21 | + |
| 22 | +In Android Studio, add `useSagp=true` to `gradle.properties` or pass it as a Gradle project property. |
| 23 | + |
| 24 | +## Build modes |
| 25 | + |
| 26 | +### With or without SAGP |
| 27 | + |
| 28 | +The sample app can be built with or without the SAGP. |
| 29 | + |
| 30 | +| Gradle Property | Required | Purpose | |
| 31 | +|-----------------|--------------------------|----------------------------------------------------------------------------------------------------------------| |
| 32 | +| `useSagp` | No (defaults to `false`) | When `true`, apply SAGP when building the sample app. When false or absent, build the sample app without SAGP. | |
| 33 | + |
| 34 | +You can configure SAGP properties via the lambda passed to `extensions.configure<SentryPluginExtension>("sentry")` in the sample app's |
| 35 | +`build.gradle.kts` file. |
| 36 | + |
| 37 | +### Builds against your local sentry-java branch |
| 38 | + |
| 39 | +Regardless of `useSagp`, the sample always depends on sentry-java modules from this monorepo (e.g., `projects.sentryAndroid`). SAGP's SDK |
| 40 | +auto-installation is disabled, so the sample never pulls a separate SDK version from Maven. Local SDK changes in your branch are picked up |
| 41 | +directly. |
| 42 | + |
| 43 | +## Viewing SDK output |
| 44 | + |
| 45 | +### Locally |
| 46 | + |
| 47 | +Debug builds enable SDK debug logging, so captured envelopes are printed to logcat (tag `Sentry`): |
| 48 | + |
| 49 | +``` |
| 50 | +adb logcat -s Sentry |
| 51 | +``` |
| 52 | + |
| 53 | +### On Sentry UI |
| 54 | + |
| 55 | +By default, SDK output produced by the sample app appears under the [sentry-sdk test project](https://sentry-sdks.sentry.io/issues/?project=5428559). |
| 56 | +To redirect them to your own project, replace the test DSN (i.e., the `io.sentry.dsn` `meta-data` value in `src/main/AndroidManifest.xml` |
| 57 | +with your own. |
0 commit comments