From 87f90428624f2f3faa16fd3a79d1560f3524435a Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 25 Nov 2026 16:18:36 +0100 Subject: [PATCH 1/3] ref(android): Remove consumer keep rules that have no effect Nothing looks up these classes or members by name: the interceptor and listener keepnames predate hardcoded integration names, the SentryOkHttpInterceptor module is gone, sentry-native's JNI uses its own io.sentry.ndk.DebugImage, and neither LayoutNode.layoutDelegate nor FillElement is referenced anymore. Refs #6771 Refs JAVA-856 Co-Authored-By: Claude Opus 5.5 --- sentry-android-core/proguard-rules.pro | 15 --------------- sentry-android-ndk/proguard-rules.pro | 3 --- sentry-android-replay/proguard-rules.pro | 4 +--- sentry-compose/proguard-rules.pro | 3 --- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index 34fc51f709a..9d7bae59305 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -48,21 +48,6 @@ # Keep Classnames for integrations -keepnames class * implements io.sentry.Integration --dontwarn io.sentry.apollo.SentryApolloInterceptor --keepnames class io.sentry.apollo.SentryApolloInterceptor - --dontwarn io.sentry.apollo3.SentryApollo3HttpInterceptor --keepnames class io.sentry.apollo3.SentryApollo3HttpInterceptor - --dontwarn io.sentry.android.okhttp.SentryOkHttpInterceptor --keepnames class io.sentry.android.okhttp.SentryOkHttpInterceptor - --dontwarn io.sentry.android.navigation.SentryNavigationListener --keepnames class io.sentry.android.navigation.SentryNavigationListener - --keepnames class io.sentry.android.core.ScreenshotEventProcessor --keepnames class io.sentry.android.core.ViewHierarchyEventProcessor - # Keep any custom option classes like SentryAndroidOptions, as they're loaded via reflection # Also keep method names, as they're e.g. used by native via JNI calls -keep class * extends io.sentry.SentryOptions { *; } diff --git a/sentry-android-ndk/proguard-rules.pro b/sentry-android-ndk/proguard-rules.pro index db825e27b4d..5d20c64a20b 100644 --- a/sentry-android-ndk/proguard-rules.pro +++ b/sentry-android-ndk/proguard-rules.pro @@ -3,9 +3,6 @@ # The Android SDK checks at runtime if this class is available via Class.forName -keep class io.sentry.android.ndk.SentryNdk { *; } -# The JNI layer uses this class through reflection --keep class io.sentry.protocol.DebugImage { *; } - # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames,includedescriptorclasses class io.sentry.** { native ; diff --git a/sentry-android-replay/proguard-rules.pro b/sentry-android-replay/proguard-rules.pro index 90a78965e89..1e7b08908d3 100644 --- a/sentry-android-replay/proguard-rules.pro +++ b/sentry-android-replay/proguard-rules.pro @@ -10,10 +10,8 @@ } # Elements without a painter member, e.g. Coil 3.1+ ContentPainterElement, are masked by name only -keepnames class **PainterElement -# Rules to detect Text colors and if they have Modifier.fillMaxWidth to later mask them +# Rules to detect Text colors to later mask them -dontwarn androidx.compose.ui.graphics.ColorProducer --dontwarn androidx.compose.foundation.layout.FillElement --keepnames class androidx.compose.foundation.layout.FillElement -keepclasseswithmembernames class * { androidx.compose.ui.graphics.ColorProducer color; } diff --git a/sentry-compose/proguard-rules.pro b/sentry-compose/proguard-rules.pro index 30473497a5f..4c847b6a053 100644 --- a/sentry-compose/proguard-rules.pro +++ b/sentry-compose/proguard-rules.pro @@ -5,9 +5,6 @@ -keep class io.sentry.compose.viewhierarchy.ComposeViewHierarchyExporter { (...); } -keepnames interface androidx.compose.ui.node.Owner --keepclassmembers class androidx.compose.ui.node.LayoutNode { - private androidx.compose.ui.node.LayoutNodeLayoutDelegate layoutDelegate; -} -keepnames class androidx.compose.foundation.ClickableElement -keepnames class androidx.compose.foundation.CombinedClickableElement From 429fd2441ec1951ee35c3bb73cc2d03121d599e8 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 25 Nov 2026 16:19:05 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 735831f2f98..6e081168e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ ## Unreleased +### Improvements + +- Android: Remove consumer keep rules that had no effect, so R8 can optimize more of your app ([#6778](https://github.com/getsentry/sentry-java/pull/6778)) + ### Fixes - Session Replay: Mask Compose images loaded with Coil 3.1+ `AsyncImage` when `maskAllImages` is enabled ([#6759](https://github.com/getsentry/sentry-java/pull/6759)) From 39cd323220506b4957a75d724980e3e059d69795 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 26 Nov 2026 16:07:17 +0100 Subject: [PATCH 3/3] ref(android): Keep event processor names for failure logs Co-Authored-By: Claude Opus 5.5 --- sentry-android-core/proguard-rules.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index 9d7bae59305..f058197818b 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -48,6 +48,10 @@ # Keep Classnames for integrations -keepnames class * implements io.sentry.Integration +# SentryClient logs the processor's class name when it throws +-keepnames class io.sentry.android.core.ScreenshotEventProcessor +-keepnames class io.sentry.android.core.ViewHierarchyEventProcessor + # Keep any custom option classes like SentryAndroidOptions, as they're loaded via reflection # Also keep method names, as they're e.g. used by native via JNI calls -keep class * extends io.sentry.SentryOptions { *; }