我尝试使用我在Udacity上的Google奖学金中学到的东西制作小项目。 不幸的是我有一个MultiSelectListPreference的错误。
代码: https://github.com/Slupik/temp10.06
错误:
FATAL EXCEPTION: main
Process: CLASS_PATH, PID: 29964
java.lang.RuntimeException: Unable to start activity ComponentInfo{CLASS_PATH/CLASS_PATH.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class (not found)MultiSelectListPreference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class (not found)MultiSelectListPreference
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class (not found)MultiSelectListPreference
at android.support.v7.preference.PreferenceInflater.createItemFromTag(PreferenceInflater.java:297)
at android.support.v7.preference.PreferenceInflater.rInflate(PreferenceInflater.java:354)
at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:162)
at android.support.v7.preference.PreferenceInflater.inflate(PreferenceInflater.java:112)
at android.support.v7.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:138)
at android.support.v7.preference.PreferenceFragmentCompat.addPreferencesFromResource(PreferenceFragmentCompat.java:432)
at CLASS_PATH.SettingsFragment.onCreatePreferences(SettingsFragment.java:15)
at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:224)
at android.support.v4.app.Fragment.performCreate(Fragment.java:2339)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1377)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1640)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1896)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3673)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338)
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at CLASS_PATH.MainActivity.onCreate(MainActivity.java:11)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
01-06 01:39:09.412 29964-29964/CLASS_PATH E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.preference.MultiSelectListPreference" on path: DexPathList[[zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/base.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_dependencies_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_0_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_1_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_2_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_3_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_4_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_5_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_6_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_7_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_8_apk.apk", zip file "/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/CLASS_PATH-0NMXgK2MJ4k_VmRAgw2kqg==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.support.v7.preference.PreferenceInflater.createItem(PreferenceInflater.java:228)
at android.support.v7.preference.PreferenceInflater.onCreateItem(PreferenceInflater.java:276)
at android.support.v7.preference.PreferenceInflater.createItemFromTag(PreferenceInflater.java:285)
... 38 more
代码是专业开发人员制作的示例代码。我只在arrays.xml和pref_visualizer.xml中添加了几行
我已经在专门的论坛上询问了这个问题,但没有人可以帮助我。所以stackoverflow的人是我最后的希望:)