Skip to content

[FSSDK-12682] Fix Jackson serializer crash caused by R8 obfuscation#539

Open
muzahidul-opti wants to merge 1 commit into
masterfrom
muzahid/FSSDK-12682-fix-jackson-r8-serializer-crash
Open

[FSSDK-12682] Fix Jackson serializer crash caused by R8 obfuscation#539
muzahidul-opti wants to merge 1 commit into
masterfrom
muzahid/FSSDK-12682-fix-jackson-r8-serializer-crash

Conversation

@muzahidul-opti

Copy link
Copy Markdown
Contributor

Summary

  • Add consumer ProGuard rules to keep Jackson PropertyNamingStrategies and PropertyNamingStrategy static field names from being obfuscated by R8

The core-api's JacksonSerializer.getSnakeCaseStrategy() uses reflection (Class.getField("SNAKE_CASE")) to look up Jackson naming strategy fields. When an app includes Jackson on its classpath and R8 obfuscates those field names, the reflection lookup fails with NoSuchFieldException, which crashes the DefaultJsonSerializer.LazyHolder static initializer. All subsequent calls to DefaultJsonSerializer.getInstance() then throw NoClassDefFoundError, preventing any event dispatch (impressions and conversions).

Since proguard-rules.txt is already configured as consumerProguardFiles, these rules are automatically merged into any app that depends on the SDK — no manual ProGuard configuration required by customers.

Both PropertyNamingStrategies (Jackson 2.12+) and PropertyNamingStrategy (Jackson 2.11 and earlier) are covered, matching the two-tier reflection fallback in JacksonSerializer.

Test plan

  • Build an app with Jackson on the classpath and R8 minification enabled
  • Verify DefaultJsonSerializer initializes without NoClassDefFoundError
  • Verify event dispatch (impressions and conversions) works through the default SDK path
  • Verify no regression when Jackson is NOT on the classpath (Gson fallback still works)

Issues

  • FSSDK-12682
  • Related: BUG-8620

…uscates naming strategy fields

Add consumer ProGuard rules to preserve Jackson PropertyNamingStrategies
and PropertyNamingStrategy static field names. The core-api's
JacksonSerializer uses reflection (getField("SNAKE_CASE")) to look up
these fields, and R8 obfuscation renames them, crashing the
DefaultJsonSerializer LazyHolder initializer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@muzahidul-opti
muzahidul-opti requested a review from jaeopt July 22, 2026 11:21
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.

1 participant