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

Proguard rules for ErrorType & Telemetry.values() #2049

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

lemnik
Copy link
Contributor

@lemnik lemnik commented Jun 28, 2024

Goal

Don't crash apps on startup where the enum.values() functions are not included in the keep list by default. Fixes #2048

Design

Included specific Proguard consumer rules for Telemetry.values() and ErrorType.values(), ensuring that these members are not removed or obfuscated.

Testing

Manually tested with app using fully customized Proguard rules.

…builds that don't include keep rules for `enum.values()`
@lemnik lemnik requested a review from tomlongridge June 28, 2024 12:08
@lemnik lemnik changed the title Declare the use of ErrorType & Telemetry.values() Proguard rules for ErrorType & Telemetry.values() Jun 28, 2024
Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

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

LGTM - with a changelog

@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1852.6 1674.82
arm64_v8a 631.04 450.82
armeabi_v7a 565.51 385.29
x86 704.75 528.62
x86_64 676.09 495.86

Generated by 🚫 Danger

@lemnik lemnik merged commit b541fca into next Jun 28, 2024
26 checks passed
@lemnik lemnik deleted the PLAT-12371/expanded-proguard-rules branch June 28, 2024 13:12
This was referenced Jul 3, 2024
@AlexanderGH
Copy link

@lemnik this PR mentions "Proguard consumer rules" but the rules modified in this PR are not consumer rules AFAICT. Consumer rules were disabled in #107

I also was unable to find any documentation that says the referenced rules should be copy pasted manually and kept up-to-date with the various artifacts.

Do you have a reference to how these rules (and those of the other sub-projects) are supposed to be included in apps?

@lemnik
Copy link
Contributor Author

lemnik commented Jul 16, 2024

Hi @AlexanderGH

The file might not be named as "consumer" but these are our configured consumer Proguard rules, as set here:
https://github.com/bugsnag/bugsnag-android/blob/next/buildSrc/src/main/kotlin/com/bugsnag/android/BugsnagBuildPlugin.kt#L206

The consumer proguard rules were removed for a time, but then reinstated to allow our NDK and other native SDKs (such as bugsnag-unity) to function as expected.

Hope this helps.

@AlexanderGH
Copy link

Thanks for the explanation! My confusion was a result of Android Studio not showing the full set of files in the .aar. But downloading it and opening the aar directly does indeed show that the proguard rules are there. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telemetry can be obfuscated but is looked up reflectively via EnumSet
4 participants