diff --git a/CHANGELOG.md b/CHANGELOG.md index 512b8ff293d..0020187e130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ ### Breaking Changes +- Android: Narrow the SDK's consumer keep rules, so R8 can optimize more of your app ([#6787](https://github.com/getsentry/sentry-java/pull/6787)) + - Members of `io.sentry` enums are no longer kept. Enum constants can be renamed or removed. + - Only the name and no-arg constructor of `SentryAndroidOptions` are kept, instead of every member of every `SentryOptions` subclass. + - `sentry-android-ndk` no longer keeps native methods of all `io.sentry.**` classes. `sentry-native-ndk` still keeps its own. + - If your code reaches any of these by name through JNI, reflection, or bindings, add your own keep rules for exactly what it uses. - The Spring Boot 3 integrations are tested against Spring Boot 3.4 and newer. Spring Boot 3.2 and 3.3 are no longer supported ([#6656](https://github.com/getsentry/sentry-java/pull/6656)) - Remove the deprecated `io.sentry.android.core.LoadClass`. Use `io.sentry.util.LoadClass` instead ([#6594](https://github.com/getsentry/sentry-java/pull/6594)) - `SentryOptions.getIgnoredErrors()`, `getIgnoredTransactions()`, `getIgnoredCheckIns()` and `getIgnoredSpanOrigins()` now return `List` instead of `List`, matching their setters ([#6489](https://github.com/getsentry/sentry-java/pull/6489)) diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index 150a214a2ec..bf7d34a0a3a 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -9,10 +9,6 @@ -keep class androidx.lifecycle.ProcessLifecycleOwner { (...); } ##---------------End: proguard configuration for androidx.lifecycle ---------- -# To mitigate the issue on R8 site (https://issuetracker.google.com/issues/235733922) -# which comes through AGP 7.3.0-betaX and 7.4.0-alphaX --keepclassmembers enum io.sentry.** { *; } - # To filter out io.sentry frames from stacktraces -keeppackagenames io.sentry.** @@ -62,9 +58,8 @@ -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 { *; } +# Sentry.init() checks this class by name, and OptionsContainer.create() instantiates it reflectively +-keep class io.sentry.android.core.SentryAndroidOptions { public (); } -keepnames class io.sentry.android.core.ApplicationNotResponding diff --git a/sentry-android-ndk/proguard-rules.pro b/sentry-android-ndk/proguard-rules.pro index db825e27b4d..d9d9da763da 100644 --- a/sentry-android-ndk/proguard-rules.pro +++ b/sentry-android-ndk/proguard-rules.pro @@ -6,11 +6,6 @@ # 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 ; -} - # don't warn jetbrains annotations -dontwarn org.jetbrains.annotations.**