混淆产生的问题
06-18 09:08:58.454 4362 4362 D AndroidRuntime: Shutting down VM 06-18 09:08:58.456 4362 4362 E AndroidRuntime: FATAL EXCEPTION: main 06-18 09:08:58.456 4362 4362 E AndroidRuntime: Process: acr.browser.lightning, PID: 4362 06-18 09:08:58.456 4362 4362 E AndroidRuntime: androidx.fragment.app.f0: Unable to instantiate fragment acr.browser.lightning.settings.fragment.PrivacySettingsFragment: make sure class name exists 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.fragment.app.r0.d(SourceFile:30) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.fragment.app.c1.a(SourceFile:28) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at acr.browser.lightning.settings.activity.SettingsActivity.f(Unknown Source:32) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.preference.Preference.P(SourceFile:92) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.preference.o.onClick(Unknown Source:2) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.view.View.performClick(View.java:7455) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.view.View.performClickInternal(View.java:7432) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.view.View.access$3700(View.java:835) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.view.View$PerformClick.run(View.java:28810) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7870) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)06-18 09:08:58.456 4362 4362 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: acr.browser.lightning.settings.fragment.PrivacySettingsFragment 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at java.lang.Class.classForName(Native Method) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at java.lang.Class.forName(Class.java:454) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.fragment.app.r0.c(SourceFile:29) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: at androidx.fragment.app.r0.d(SourceFile:3) 06-18 09:08:58.456 4362 4362 E AndroidRuntime: ... 16 more 06-18 09:08:58.456 4362 4362 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: acr.browser.lightning.settings.fragment.PrivacySettingsFragment 06-18 09:08:58.456 4362 4362 E AndroidRuntime: ... 20 more
解决方法:
在 proguard-project.txt添加对应的规则取消对Fragment的混淆
-keep public class * extends androidx.preference.PreferenceFragmentCompat