From e353c7f27ae3c0018b5aa88a9a84dd20be4e98bc Mon Sep 17 00:00:00 2001 From: Jintin Date: Sat, 1 Aug 2026 23:00:00 +0800 Subject: [PATCH] Ship consumer ProGuard rules fixing minified-build crashes 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 Signed-off-by: Jintin --- lib/consumer-rules.pro | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/consumer-rules.pro b/lib/consumer-rules.pro index e69de29..fff1925 100644 --- a/lib/consumer-rules.pro +++ b/lib/consumer-rules.pro @@ -0,0 +1,19 @@ +# BindingExtension discovers the binding class at runtime by walking +# generic supertype signatures (findClass in Utils.kt) and then invoking +# the binding's static inflate(...) reflectively. R8 strips the Signature +# attribute and inflate methods by default, which crashes every +# BindingActivity/BindingFragment in minified builds (see issue #11). + +-keepattributes Signature + +-keep class com.jintin.bindingextension.** { *; } + +# Keep subclasses (and their generic signatures) so the supertype walk +# still finds the parameterized BindingActivity/BindingFragment. +-keep class * extends com.jintin.bindingextension.BindingActivity +-keep class * extends com.jintin.bindingextension.BindingFragment + +-keepclassmembers class * implements androidx.viewbinding.ViewBinding { + public static ** inflate(...); + public static ** bind(android.view.View); +}