Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Proguard/R8 rules #1976

Closed
Thomas-Vos opened this issue Apr 6, 2022 · 6 comments
Closed

Fix Proguard/R8 rules #1976

Thomas-Vos opened this issue Apr 6, 2022 · 6 comments

Comments

@Thomas-Vos
Copy link

Integration

sentry-android

Build System

Gradle

AGP Version

all

Proguard

Enabled

Version

6.0.0-alpha.4

Steps to Reproduce

The Proguard/R8 rules keep far too many classes. See for example the following file:

https://github.com/getsentry/sentry-java/blob/6.x.x/sentry-android-core/proguard-rules.pro

Lots of those rules seem to be needed for GSON, but GSON was removed in 6.x.x. So the rules can be reduced.

Specifically the following:

# Application classes that will be serialized/deserialized
-keep class io.sentry.** { *; }
-keepclassmembers enum io.sentry.** { *; }
-keep class io.sentry.android.core.** { *; }

This should either be changed to keep specific classes, or just removed completely as GSON is no longer used.

Same for the other rules, some of them seem like they were added for GSON but never removed.

Expected Result

Remove a lot of the rules

Actual Result

Too many classes are kept

@marandaneto
Copy link
Contributor

@Thomas-Vos indeed, it's in our backlog to find out what really needs to be excluded from minification or not, e.g., every public API class, interfaces, classes used in reflection, etc.

@marandaneto marandaneto added the enhancement New feature or request label Apr 7, 2022
@Thomas-Vos
Copy link
Author

I am using Sentry in a JVM desktop app with R8 obfuscation. With the alpha version mentioned I did not need to add any additional rules for Sentry.

@marandaneto
Copy link
Contributor

I am using Sentry in a JVM desktop app with R8 obfuscation. With the alpha version mentioned I did not need to add any additional rules for Sentry.

Yep, nothing needs to be added, it's about removing the not needed rules anymore.

@Thomas-Vos
Copy link
Author

Yes, what I meant was that I did not need to add any rules at all. The rules in the Android module were not included in my project as I only depend on the Java dependency.

@bruno-garcia
Copy link
Member

Since we're serializing things 'by hand' on 6.0.0, I think we can be very lenient in the rules now

@philipphofmann
Copy link
Member

Was fixed with #2031

Repository owner moved this from Needs Discussion to Done in Mobile & Cross Platform SDK Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants