AndroidX crashes on MultiSelectListPreference

I am having trouble getting Jetpack/AndroidX preferences to work with MultiSelectListPreference. I have reduced my code down to the simplest example project here: https://github.com/quittle/a11y-ally/tree/simple-multi-list.

For some reason, the most basic Activity with a single preference fragment with a single, empty MultiSelectListPreference crashes when using the AndroidX classes, but doesn’t with the vanilla Android APIs that have been deprecated in Android SDK level 28.

I have found https://code.videolan.org/videolan/vlc-android/commit/1464d1a6ab882eec78ab3a749e8f06e52bbd7404, which seems to indicate this may be an issue with the AppCompat libraries, but doesn’t fix my setup when adapted to use the AndroidX libraries.

Minimal code snippets of code consuming the Preferences

Works

public class VanillaMainActivity extends Activity {     public static class CustomPreferenceFragment extends PreferenceFragment {         @Override         public void onCreate(final Bundle savedInstanceState) {             super.onCreate(savedInstanceState);             addPreferencesFromResource(R.xml.preferences);         }     }      public void onCreate(final Bundle savedInstanceState) {         super.onCreate(savedInstanceState);          setContentView(R.layout.main_activity);          getFragmentManager()             .beginTransaction()             .replace(R.id.preferences_holder, new CustomPreferenceFragment())             .commit();     } } 

Crashes

public class AndroidXMainActivity extends FragmentActivity {     public static class CustomPreferenceFragment extends PreferenceFragmentCompat {         @Override         public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {             addPreferencesFromResource(R.xml.preferences);         }     }      public void onCreate(final Bundle savedInstanceState) {         super.onCreate(savedInstanceState);          setContentView(R.layout.main_activity);          getSupportFragmentManager()                 .beginTransaction()                 .replace(R.id.preferences_holder, new CustomPreferenceFragment())                 .commit();     } } 

The stacktrace I get when using the AndroidX library is below.

2018-11-05 20:32:22.318 18080-18080/com.example E/com.example: Invalid ID 0x00000000. 2018-11-05 20:32:22.320 18080-18080/com.example E/AndroidRuntime: FATAL EXCEPTION: main     Process: com.example, PID: 18080     android.content.res.Resources$  NotFoundException: Resource ID #0x0         at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)         at android.content.res.Resources.loadXmlResourceParser(Resources.java:2155)         at android.content.res.Resources.getLayout(Resources.java:1155)         at android.view.LayoutInflater.inflate(LayoutInflater.java:421)         at android.view.LayoutInflater.inflate(LayoutInflater.java:374)         at androidx.appcompat.app.AlertController$  AlertParams.createListView(AlertController.java:989)         at androidx.appcompat.app.AlertController$  AlertParams.apply(AlertController.java:965)         at androidx.appcompat.app.AlertDialog$  Builder.create(AlertDialog.java:982)         at androidx.preference.PreferenceDialogFragmentCompat.onCreateDialog(PreferenceDialogFragmentCompat.java:158)         at androidx.fragment.app.DialogFragment.onGetLayoutInflater(DialogFragment.java:330)         at androidx.fragment.app.Fragment.performGetLayoutInflater(Fragment.java:1308)         at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)         at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)         at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)         at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)         at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)         at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)         at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)         at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)         at androidx.fragment.app.FragmentManagerImpl$  1.run(FragmentManager.java:733)         at android.os.Handler.handleCallback(Handler.java:873)         at android.os.Handler.dispatchMessage(Handler.java:99)         at android.os.Looper.loop(Looper.java:193)         at android.app.ActivityThread.main(ActivityThread.java:6669)         at java.lang.reflect.Method.invoke(Native Method)         at com.android.internal.os.RuntimeInit$  MethodAndArgsCaller.run(RuntimeInit.java:493)         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)