bugsnag / bugsnag-android

BugSnag crash monitoring and reporting tool for Android apps
https://www.bugsnag.com/platforms/android/
Other
1.19k stars 205 forks source link

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

Closed lemnik closed 4 months ago

lemnik commented 4 months ago

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.

bugsnagbot commented 4 months ago

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 :no_entry_sign: Danger

AlexanderGH commented 3 months ago

@lemnik this PR mentions "Proguard consumer rules" but the rules modified in this PR are not consumer rules AFAICT. Consumer rules were disabled in https://github.com/bugsnag/bugsnag-android/issues/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 commented 3 months ago

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 commented 3 months ago

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. 👍