PreferenceScreen has been deprecated by API 29

It's deprecated in API level 29 base on Google Document and also by the Google recommendation you should use AndroidX Preference Library instead.

You can check AndroidX Preference guide in this link

If you still have the problem after Migrate to Androidx you can use

<androidx.preference.PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">

</androidx.preference.PreferenceScreen>

instead of

<PreferenceScreen
    xmlns:app="http://schemas.android.com/apk/res-auto">


</PreferenceScreen>

It's not necessary but you can add this implementation into your Gradle too.

implementation 'androidx.preference:preference:X.Y.Z'

As described in the official doc:

This class was deprecated in API level 29.
Use the AndroidX Preference Library for consistent behavior across all devices

Tags:

Android