我看到我的Android应用程序崩溃了很多,其中包含android.view.InflateException。不幸的是,它不会发生在我的设备或模拟器上,错误告诉我什么。我假设它适用于大多数设备,错误主要发生在Android 4.x中,很少发生在5上。 你们有人能帮助我吗?那太好了! 当用户打开我的偏好活动时,似乎会发生这种情况。这是堆栈跟踪:
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invokeNative(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method:0)
Caused by: android.view.InflateException:
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:315)
at bloggersoft.sudokuoftheday.EinstellungenActivity$MyPreferenceFragment.onCreate(EinstellungenActivity.java:305)
at android.app.Fragment.performCreate(Fragment.java:1678)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:859)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.BackStackRecord.run(BackStackRecord.java:684)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
at android.app.Activity.performStart(Activity.java:5467)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
答案 0 :(得分:0)
我要道歉。我发布的代码是开发人员控制台堆栈跟踪的完整输出,并没有帮助我,在正确的模拟器中测试它时显示错误:我忘了为MultiSelectList首选项设置默认值。这解决了它。