androidx.preference.PreferenceScreen not found when creating Preferences screen

if you want to use PreferenceFragmentCompat first you need to implement the following dependency in you app level gradle.

implementation 'androidx.preference:preference:1.0.0

If you're using AndroidX, you should update your dependencies:

implementation "androidx.legacy:legacy-preference-v14:1.0.0"
implementation "androidx.preference:preference:1.0.0"

The legacy is for the old com.android.support:preference-v14 while the other is for com.android.support:preference-v7.

If you don't use AndroidX but Android Support libraries, do not import AndroidX widgets into your XML.