我正在尝试在 Android 设置应用程序中添加一个片段来自定义我正在处理的 ROM。这是我根据logcat强制关闭时遇到的错误。
E/AndroidRuntime(31496): FATAL EXCEPTION: main
E/AndroidRuntime(31496): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.SubSettings}: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.settings.pcf.RomSettings: make sure class name exists, is public, and has an empty constructor that is public
E/AndroidRuntime(31496): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
E/AndroidRuntime(31496): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
E/AndroidRuntime(31496): at android.app.ActivityThread.access$600(ActivityThread.java:150)
E/AndroidRuntime(31496): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
E/AndroidRuntime(31496): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(31496): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(31496): at android.app.ActivityThread.main(ActivityThread.java:5193)
E/AndroidRuntime(31496): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(31496): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(31496): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
E/AndroidRuntime(31496): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
E/AndroidRuntime(31496): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(31496): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.settings.pcf.RomSettings: make sure class name exists, is public, and has an empty constructor that is public
E/AndroidRuntime(31496): at android.app.Fragment.instantiate(Fragment.java:592)
E/AndroidRuntime(31496): at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1138)
E/AndroidRuntime(31496): at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1154)
E/AndroidRuntime(31496): at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:539)
E/AndroidRuntime(31496): at com.android.settings.Settings.onCreate(Settings.java:152)
E/AndroidRuntime(31496): at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime(31496): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(31496): at E/AndroidRuntime(31496): ... 11 more
E/AndroidRuntime(31496): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.settings.pcf.RomSettings" on path: /system/app/Settings.apk
E/AndroidRuntime(31496): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
E/AndroidRuntime(31496): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime(31496): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime(31496): at android.app.Fragment.instantiate(Fragment.java:582)
E/AndroidRuntime(31496): ... 18 more
课程是公开的,一切都是如此。我确定这个名字是对的。这是我的 Github 的链接,其中包含该文件:https ://github.com/konstantinkeller/android_packages_apps_Settings/blob/jb4.2.1/src/com/android/settings/pcf/RomSettings.java
这就是整个包裹。您还可以检查 XML 和所有内容。谁能帮我?谢谢。