Android PreferenceFragment在实例化过程中不断崩溃
在我的Android应用程序中,我使用AppCompatPreferenceActivity和PreferenceFragment实现了设置页面。在Crashlytics中,我发现当使用以下消息实例化PreferenceFragment时,许多设备崩溃:Android PreferenceFragment在实例化过程中不断崩溃,android,Android,在我的Android应用程序中,我使用AppCompatPreferenceActivity和PreferenceFragment实现了设置页面。在Crashlytics中,我发现当使用以下消息实例化PreferenceFragment时,许多设备崩溃: Unable to start activity ComponentInfo android.app.Fragment$InstantiationException: Unable to instantiate fragment: make s
Unable to start activity ComponentInfo android.app.Fragment$InstantiationException: Unable to instantiate fragment: make sure class name exists, is public, and has an empty constructor that is public.
然而,我很确定在fragment中我实现了一个空构造函数,并且PreferenceFragment和AppCompatPreferenceActivity都是“公共”的,那么我还应该怎么做才能防止它再次崩溃呢
此外,我还把这一点写进了我的职业后卫规则中:
-keep public class * extends android.preference.PreferenceFragment
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v4.app.FragmentActivity