From 0e75a127d738fe17d983888c1fbbf51e346c7c08 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 6 Jul 2026 14:40:11 +0200 Subject: [PATCH] feat(samples): Distinguish debug and release builds of the Android sample Give the Android sample a `.debug` application id suffix and a "Sentry Sample Debug" launcher label so debug and release builds can be installed side by side and told apart on the home screen. Add a build type badge (DEBUG/RELEASE) under the Sentry logo in the navigation rail so the running build is visible inside the app too. Co-Authored-By: Claude Opus 4.8 --- sentry-samples/sentry-samples-android/build.gradle.kts | 2 ++ .../src/debug/res/values/strings.xml | 4 ++++ .../java/io/sentry/samples/android/MainActivity.kt | 10 ++++++++++ .../src/main/res/values/strings.xml | 1 - .../src/release/res/values/strings.xml | 4 ++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 sentry-samples/sentry-samples-android/src/debug/res/values/strings.xml create mode 100644 sentry-samples/sentry-samples-android/src/release/res/values/strings.xml diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 96ded862f95..f994081450d 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -111,6 +111,8 @@ android { buildTypes { getByName("debug") { + // Suffix the id so debug and release builds can be installed side by side. + applicationIdSuffix = ".debug" addManifestPlaceholders(mapOf("sentryDebug" to true, "sentryEnvironment" to "debug")) } getByName("release") { diff --git a/sentry-samples/sentry-samples-android/src/debug/res/values/strings.xml b/sentry-samples/sentry-samples-android/src/debug/res/values/strings.xml new file mode 100644 index 00000000000..ef5dee529b6 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/debug/res/values/strings.xml @@ -0,0 +1,4 @@ + + Sentry Sample Debug + DEBUG + diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt index 9fdcaafb008..90e75feee71 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt @@ -77,6 +77,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -246,6 +247,15 @@ fun CategoryNavigationRail( .padding(12.dp) .rotate(rotation.value), ) + Spacer(Modifier.height(8.dp)) + Text( + text = stringResource(R.string.build_type), + style = MaterialTheme.typography.labelSmall, + fontWeight = FontWeight.Bold, + color = + if (BuildConfig.DEBUG) MaterialTheme.colorScheme.error + else MaterialTheme.colorScheme.primary, + ) Spacer(Modifier.height(16.dp)) Category.entries.forEach { category -> NavigationRailItem( diff --git a/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml b/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml index 690e6ea7256..2f42a4bff1d 100644 --- a/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml +++ b/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml @@ -1,5 +1,4 @@ - Sentry sample Crash from Java (UncaughtException) Out of Memory (Mulithreaded) Stack Overflow diff --git a/sentry-samples/sentry-samples-android/src/release/res/values/strings.xml b/sentry-samples/sentry-samples-android/src/release/res/values/strings.xml new file mode 100644 index 00000000000..f227a4c9298 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/release/res/values/strings.xml @@ -0,0 +1,4 @@ + + Sentry Sample + RELEASE +