From d667732b0fa5dd98ff4417b8f7ad80edc8f4f806 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 14:29:05 +0000 Subject: [PATCH] fix(replay): add explicit ComposeRect type reference to prevent DexGuard stripping Under aggressive obfuscation (e.g. DexGuard), androidx.compose.ui.geometry.Rect was only present as an implicit return type of localBoundingBoxOf() and had no direct import. DexGuard could strip or rename the class, leaving ComposeViewHierarchyNode with an unresolvable type reference at runtime, causing a fatal VerifyError. Adding an explicit import alias and annotating the bounds variable with the concrete type creates a hard bytecode reference that obfuscation tools will preserve. Fixes #5497 Co-authored-by: no --- .../src/main/java/io/sentry/android/replay/util/Nodes.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt index 2882b2113b8..2f08b4685b7 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt @@ -4,6 +4,7 @@ package io.sentry.android.replay.util import android.graphics.Rect import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Rect as ComposeRect import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorProducer import androidx.compose.ui.graphics.painter.Painter @@ -169,7 +170,9 @@ internal fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates // pass clipBounds explicitly to avoid the `localBoundingBoxOf$default` bridge that AGP 8.13's D8 // desugars inconsistently on minSdk < 24 - val bounds = root.localBoundingBoxOf(this, true) + // Explicit type reference ensures androidx.compose.ui.geometry.Rect is not stripped by aggressive + // obfuscation tools (e.g. DexGuard), which can miss implicit return types and cause VerifyError. + val bounds: ComposeRect = root.localBoundingBoxOf(this, true) val boundsLeft = bounds.left.fastCoerceIn(0f, rootWidth) val boundsTop = bounds.top.fastCoerceIn(0f, rootHeight) val boundsRight = bounds.right.fastCoerceIn(0f, rootWidth)