Skip to content

Ship consumer ProGuard rules fixing minified-build crashes - #16

Open
Jintin wants to merge 1 commit into
masterfrom
fix/consumer-proguard-rules
Open

Ship consumer ProGuard rules fixing minified-build crashes#16
Jintin wants to merge 1 commit into
masterfrom
fix/consumer-proguard-rules

Conversation

@Jintin

@Jintin Jintin commented Aug 1, 2026

Copy link
Copy Markdown
Owner

consumer-rules.pro was already wired via consumerProguardFiles but the file was empty, so consumers' minified builds crash at first Activity launch: R8 strips the Signature attribute, findClass() in Utils.kt never sees a ParameterizedType, walks past Object, and throws (javaClass.superclass must not be null / NPE).

This ships the rules with the library so every consumer gets them automatically:

  • -keepattributes Signature — the piece the README's suggested rule was missing, which is why NullPointerException when proguard is enabled #11's reporter still crashed with the inflate keep applied
  • keep the library classes and BindingActivity/BindingFragment subclasses so the supertype walk survives class merging/obfuscation
  • keep inflate(...)/bind(...) on all ViewBinding implementations (supersedes the manual README step)

Verified in PM25-Android: same crash reproduced in its first R8-enabled release build; these rules fix it.

Fixes #11

🤖 Generated with Claude Code

consumer-rules.pro was wired into the library but empty, so R8 stripped
the Signature attribute consumers' apps need for findClass() to resolve
the binding type, crashing every BindingActivity/BindingFragment at
launch in minified builds.

Fixes #11

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Jintin <jintin.lin1018@gmail.com>
@Jintin
Jintin force-pushed the fix/consumer-proguard-rules branch from bfb8267 to e353c7f Compare August 8, 2026 01:41
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.

NullPointerException when proguard is enabled

1 participant