Skip to content

fix(android): Preserve custom Throwable identities - #5881

Merged
romtsn merged 3 commits into
mainfrom
fix/android-preserve-throwable-identities
Aug 6, 2026
Merged

fix(android): Preserve custom Throwable identities#5881
romtsn merged 3 commits into
mainfrom
fix/android-preserve-throwable-identities

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Prevent R8 horizontal class merging from collapsing unrelated custom Throwable subclasses into one runtime type. This keeps captured exception types aligned with retraced constructor frames and avoids incorrect issue titles or grouping.

Consumer ProGuard rule

sentry-android-core now exports a broad rule that preserves distinct throwable class identities while still allowing unused classes to be removed and retained classes to be obfuscated:

-keep,allowshrinking,allowobfuscation class * extends java.lang.Throwable

The rule follows the mitigation recommended by the R8 maintainers.

Requested by Roman Zavarnitsyn.

--

View Junior Session Sentry

sentry-junior Bot and others added 2 commits July 31, 2026 07:47
Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io>
@sentry

sentry Bot commented Jul 31, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.52.0 (1) release

⚙️ sentry-android Build Distribution Settings

@romtsn
romtsn marked this pull request as ready for review July 31, 2026 07:58
@romtsn romtsn added the ship-it PR is ready to merge from a reviewer perspective label Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 326.54 ms 379.51 ms 52.97 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d15471f 303.49 ms 439.08 ms 135.59 ms
b750b96 408.98 ms 480.32 ms 71.34 ms
17a0955 372.53 ms 446.70 ms 74.17 ms
d217708 355.34 ms 381.39 ms 26.05 ms
5b1a06b 310.56 ms 362.79 ms 52.22 ms
fcec2f2 311.35 ms 384.94 ms 73.59 ms
62b579c 349.26 ms 426.26 ms 77.00 ms
5f14e5d 325.76 ms 368.32 ms 42.56 ms
48277cd 320.38 ms 379.90 ms 59.52 ms
a416a65 295.53 ms 373.74 ms 78.21 ms

App size

Revision Plain With Sentry Diff
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
b750b96 1.58 MiB 2.10 MiB 533.19 KiB
17a0955 1.58 MiB 2.10 MiB 533.20 KiB
d217708 1.58 MiB 2.10 MiB 532.97 KiB
5b1a06b 0 B 0 B 0 B
fcec2f2 1.58 MiB 2.12 MiB 551.51 KiB
62b579c 0 B 0 B 0 B
5f14e5d 1.58 MiB 2.19 MiB 620.00 KiB
48277cd 0 B 0 B 0 B
a416a65 1.58 MiB 2.12 MiB 555.26 KiB

Previous results on branch: fix/android-preserve-throwable-identities

Startup times

Revision Plain With Sentry Diff
ef5f2d8 382.20 ms 455.94 ms 73.74 ms

App size

Revision Plain With Sentry Diff
ef5f2d8 0 B 0 B 0 B

Comment thread sentry-android-core/proguard-rules.pro
Comment thread sentry-android-core/proguard-rules.pro

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice find!

Comment thread sentry-android-core/proguard-rules.pro
@romtsn
romtsn merged commit 32a6f2e into main Aug 6, 2026
77 of 79 checks passed
@romtsn
romtsn deleted the fix/android-preserve-throwable-identities branch August 6, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants