1

I am receiving this error on API 15 devices only it seems. It appears to be an issue with the animations or something, but I have no idea what to do to fix this. When I launch my app, it force closes. On API 17, however, it works fine.

This is the line that appears to be causing it:

PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

And here is the stack trace:

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to create application com.ianmcdowell.googlevoicemessaging.MmsApp: android.view.InflateException: Binary XML file line #2: Error inflating class alpha
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3957)
    at android.app.ActivityThread.access$1300(ActivityThread.java:123)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class alpha
    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
    at android.preference.GenericInflater.inflate(GenericInflater.java:317)
    at android.preference.GenericInflater.inflate(GenericInflater.java:263)
    at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
    at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:462)
    at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:440)
    at com.ianmcdowell.googlevoicemessaging.MmsApp.onCreate(MmsApp.java:65)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3954)
    ... 10 more
Caused by: java.lang.ClassNotFoundException: android.preference.alpha
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.preference.GenericInflater.createItem(GenericInflater.java:375)
    at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
    at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
    ... 18 more

Let me know if you need any more information...

EDIT: preferences.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory android:title="@string/pref_sms_appearance_title">
        <CheckBoxPreference android:title="@string/pref_title_darktheme" android:key="pref_key_darktheme" android:summary="@string/pref_summary_darktheme" android:defaultValue="false" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_sms_googlevoice_title" android:key="pref_key_storage_gvsettings">
        <CheckBoxPreference android:title="@string/pref_title_gv_enable" android:key="pref_key_gv_enable" android:summary="@string/pref_summary_gv_enable" android:defaultValue="false" />
        <ListPreference android:entries="@array/prefEntries_gvsendtextwith" android:title="@string/pref_sms_googlevoice_composewith_title" android:key="pref_key_gvSendViaPref" android:defaultValue="0" android:entryValues="@array/prefValues_gvsendtextwith" />
        <CheckBoxPreference android:title="@string/pref_title_gv_smartreply" android:key="pref_key_gv_smartreply" android:summary="@string/pref_summary_gv_smartreply" android:defaultValue="true" />
        <CheckBoxPreference android:title="@string/pref_title_gv_markasread" android:key="pref_key_gv_markasread" android:summary="@string/pref_summary_gv_markasread" android:defaultValue="false" />
        <Preference android:title="@string/pref_title_gv_settings" android:key="pref_key_sms_gv_settings" android:summary="@string/pref_summary_gv_settings" />
        <Preference android:title="@string/pref_title_gv_help" android:key="pref_key_sms_gv_help" android:summary="@string/pref_summary_gv_help" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_notification_settings_title">
        <CheckBoxPreference android:title="@string/pref_title_notification_enabled" android:key="pref_key_enable_notifications" android:summary="@string/pref_summary_notification_enabled" android:defaultValue="true" />
        <RingtonePreference android:layout="?android:preferenceLayoutChild" android:title="@string/pref_title_notification_ringtone" android:key="pref_key_ringtone" android:dependency="pref_key_enable_notifications" android:defaultValue="content://settings/system/notification_sound" android:ringtoneType="notification" />
        <ListPreference android:entries="@array/prefEntries_vibrateWhen" android:layout="?android:preferenceLayoutChild" android:title="@string/pref_title_notification_vibrateWhen" android:key="pref_key_vibrateWhen" android:summary="@string/pref_summary_notification_vibrateWhen" android:dependency="pref_key_enable_notifications" android:defaultValue="@string/prefDefault_vibrate_true" android:dialogTitle="@string/prefDialogTitle_vibrateWhen" android:entryValues="@array/prefValues_vibrateWhen" />
        <CheckBoxPreference android:title="@string/pref_title_popupnotification_enabled" android:key="pref_key_enable_popupnotifications" android:summary="@string/pref_summary_popupnotification_enabled" android:dependency="pref_key_enable_notifications" android:defaultValue="true" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_sms_storage_title" android:key="pref_key_storage_settings">
        <CheckBoxPreference android:title="@string/pref_title_auto_delete" android:key="pref_key_auto_delete" android:summary="@string/pref_summary_auto_delete" android:defaultValue="false" />
        <Preference android:persistent="false" android:title="@string/pref_title_sms_delete" android:key="pref_key_sms_delete_limit" android:summary="@string/pref_summary_delete_limit" android:dependency="pref_key_auto_delete" />
        <Preference android:persistent="false" android:title="@string/pref_title_mms_delete" android:key="pref_key_mms_delete_limit" android:summary="@string/pref_summary_delete_limit" android:dependency="pref_key_auto_delete" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_sms_settings_title" android:key="pref_key_sms_settings">
        <CheckBoxPreference android:title="@string/pref_title_sms_delivery_reports" android:key="pref_key_sms_delivery_reports" android:summary="@string/pref_summary_sms_delivery_reports" android:defaultValue="false" />
        <Preference android:title="@string/pref_title_manage_sim_messages" android:key="pref_key_manage_sim_messages" android:summary="@string/pref_summary_manage_sim_messages" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_mms_settings_title" android:key="pref_key_mms_settings">
        <CheckBoxPreference android:title="@string/pref_title_mms_delivery_reports" android:key="pref_key_mms_delivery_reports" android:summary="@string/pref_summary_mms_delivery_reports" android:defaultValue="false" />
        <CheckBoxPreference android:title="@string/pref_title_mms_read_reports" android:key="pref_key_mms_read_reports" android:summary="@string/pref_summary_mms_read_reports" android:defaultValue="false" />
        <CheckBoxPreference android:title="@string/pref_title_mms_auto_retrieval" android:key="pref_key_mms_auto_retrieval" android:summary="@string/pref_summary_mms_auto_retrieval" android:defaultValue="true" />
        <CheckBoxPreference android:layout="?android:preferenceLayoutChild" android:title="@string/pref_title_mms_retrieval_during_roaming" android:key="pref_key_mms_retrieval_during_roaming" android:summary="@string/pref_summary_mms_retrieval_during_roaming" android:dependency="pref_key_mms_auto_retrieval" android:defaultValue="false" />
    </PreferenceCategory>

</PreferenceScreen>
IMcD23
  • 445
  • 1
  • 7
  • 13

1 Answers1

0

I know this is an old question, but thought I would share a solution.

There is a limited amount of information available in your original question, however I believe this solution still applies.

I reviewed the Guide on creating a Preference Screen (I assume you did the same). This guide can found on the Android Developer Guides site.

They seem to be missing a call to set the actual activity content (screen components like buttons, layouts, etc.) known as setContentView(View) used in either Activity or [AppCompatActivity][].

TL;DR

Add to your SettingsActivity.java file

setContentView(R.layout.my_settings_activity_layout);

where my_settings_activity_layout is the file name of the corresponding MySettingsActivity.java layout file

CybeX
  • 2,060
  • 3
  • 48
  • 115