Sample application demonstrating how to use the Sentry Android SDK, including core functionality (error reporting, tracing, session replay, profiling) and integrations (Compose, OkHttp, SQLite, etc.).
Install the app on your device or emulator:
./gradlew :sentry-samples:sentry-samples-android:installDebug
or simply open the project in Android Studio and run the sentry-samples-android configuration.
You can also apply the Sentry Android Gradle Plugin (SAGP) when building (not applied by default):
./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp
In Android Studio, add useSagp= (empty value) to gradle.properties, or pass -PuseSagp as a Gradle project property.
The sample app can be built with or without the SAGP.
| Gradle Property | Required | Purpose |
|---|---|---|
useSagp |
No | When present, apply SAGP when building the sample app. Omit the property to build without SAGP. |
You can configure SAGP properties via the lambda passed to extensions.configure<SentryPluginExtension>("sentry") in the sample app's
build.gradle.kts file.
-PuseSagp builds check mavenLocal() first when resolving SAGP. To test a local SAGP branch:
- In your
sentry-android-gradle-plugincheckout, temporarily set a unique local version inplugin-build/gradle.properties(e.g.6.10.0-LOCAL) and publish to Maven Local:
./gradlew -p plugin-build publishToMavenLocal
Re-run publishToMavenLocal after each SAGP change.
- Temporarily bump the
sagppin ingradle/libs.versions.tomlto match that version.
Then build from sentry-java:
./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp
Debug builds enable SDK debug logging, so captured envelopes are printed to logcat (tag Sentry):
adb logcat -s Sentry
By default, SDK output produced by the sample app appears under the sentry-sdk test project.
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
with your own.