Bugsnag can fail to initialize when loading on startup in an obfuscated/minified app because Telemetry is loaded into an EnumSet her:
This results in a runtime crash like so:
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: com.bugsnag.android.b1.values []
at java.lang.Enum.enumValues(Enum.java:315)
at java.lang.Enum.-$$Nest$smenumValues(Unknown Source:0)
at java.lang.Enum$1.create(Enum.java:322)
at java.lang.Enum$1.create(Enum.java:320)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:334)
at java.lang.Class.getEnumConstantsShared(Class.java:4036)
at java.util.EnumSet.getUniverse(EnumSet.java:410)
at java.util.EnumSet.noneOf(EnumSet.java:112)
at java.util.EnumSet.of(EnumSet.java:238)
at com.bugsnag.android.s.<init>(Unknown Source:128)
at A.M.<init>(SourceFile:11)
at com.bugsnag.android.l.h(Unknown Source:4)
at dev.zacsweers.fieldspottr.MainActivity.onCreate(Unknown Source:26)
Worse still, because this happens during initialization, it will never be reported!
Environment
Android version: N/A
Bugsnag version: 6.6.0
Emulator or physical device: N/A
The solution would either to be to bundle consumer proguard rules that keep this enum, annotate it with @Keep, or consider moving off of EnumSet usage.
Describe the bug
Bugsnag can fail to initialize when loading on startup in an obfuscated/minified app because
Telemetry
is loaded into anEnumSet
her:This results in a runtime crash like so:
Worse still, because this happens during initialization, it will never be reported!
Environment
The solution would either to be to bundle consumer proguard rules that keep this enum, annotate it with
@Keep
, or consider moving off ofEnumSet
usage.