From f28252bfd5969002bcb31686b087d3bd72a829ae Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Fri, 13 Jan 2023 19:51:42 +0100 Subject: [PATCH] Keep all subclasses of PreferenceFragmentCompat (#3162) * Mark *PreferencesFragment as @Keep PreferenceFragment references them by string name, which doesn't work after ProGuard has obfuscated the code in release mode. The name is no longer valid and the app crashes. Fixes https://github.com/tuskyapp/Tusky/issues/3161 * Prefer to keep Preference classes with a Proguard rule Ensures that all PreferenceFragmentCompat are kept, to prevent the risk that this could break in a new fragment where `@Keep` is accidentally omitted. --- app/proguard-rules.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 7f0c43258..9ab3dd83f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -111,3 +111,7 @@ static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); static void throwUninitializedPropertyAccessException(java.lang.String); } + +# Preference fragments can be referenced by name, ensure they remain +# https://github.com/tuskyapp/Tusky/issues/3161 +-keep class * extends androidx.preference.PreferenceFragmentCompat