Skip to content

Commit 803fad4

Browse files
runningcodeclaude
andauthored
feat(samples): Distinguish debug and release builds of the Android sample (#5724)
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 <noreply@anthropic.com>
1 parent 7a19fee commit 803fad4

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎sentry-samples/sentry-samples-android/build.gradle.kts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ android {
111111

112112
buildTypes {
113113
getByName("debug") {
114+
// Suffix the id so debug and release builds can be installed side by side.
115+
applicationIdSuffix = ".debug"
114116
addManifestPlaceholders(mapOf("sentryDebug" to true, "sentryEnvironment" to "debug"))
115117
}
116118
getByName("release") {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="app_name">Sentry Sample Debug</string>
3+
<string name="build_type">DEBUG</string>
4+
</resources>

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import androidx.compose.ui.graphics.Color
7777
import androidx.compose.ui.graphics.vector.ImageVector
7878
import androidx.compose.ui.platform.LocalContext
7979
import androidx.compose.ui.res.painterResource
80+
import androidx.compose.ui.res.stringResource
8081
import androidx.compose.ui.text.font.FontWeight
8182
import androidx.compose.ui.text.style.TextAlign
8283
import androidx.compose.ui.text.style.TextOverflow
@@ -246,6 +247,15 @@ fun CategoryNavigationRail(
246247
.padding(12.dp)
247248
.rotate(rotation.value),
248249
)
250+
Spacer(Modifier.height(8.dp))
251+
Text(
252+
text = stringResource(R.string.build_type),
253+
style = MaterialTheme.typography.labelSmall,
254+
fontWeight = FontWeight.Bold,
255+
color =
256+
if (BuildConfig.DEBUG) MaterialTheme.colorScheme.error
257+
else MaterialTheme.colorScheme.primary,
258+
)
249259
Spacer(Modifier.height(16.dp))
250260
Category.entries.forEach { category ->
251261
NavigationRailItem(

‎sentry-samples/sentry-samples-android/src/main/res/values/strings.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<resources>
2-
<string name="app_name">Sentry sample</string>
32
<string name="crash_from_java">Crash from Java (UncaughtException)</string>
43
<string name="out_of_memory">Out of Memory (Mulithreaded)</string>
54
<string name="stack_overflow">Stack Overflow</string>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="app_name">Sentry Sample</string>
3+
<string name="build_type">RELEASE</string>
4+
</resources>

0 commit comments

Comments
 (0)