Android

Where Does Android Store SharedPreferences Files?

SharedPreferences live as XML files in a shared_prefs folder inside the app's private data directory, one file per preference set.

Last updated

SharedPreferences is Android's simplest persistence: key value pairs in an XML file, one file per named preference set, inside a shared_prefs folder under the app's private data directory. Every app using the default preferences gets the same layout with its package name in the path.

The sandbox rules apply as usual. Debug builds expose the file through Android Studio, while production devices do not. Developers debugging a misbehaving setting should pull the XML and read it directly rather than guessing from app behavior, since stale values there explain most preference bugs.

Where Android SharedPreferences stores this, by platform

Android
/data/data/[package]/shared_prefs/[name].xml

One XML file per preference set, named after the set. Reach it through Android Studio Device Explorer on debug builds or adb on rooted test devices. Production phones hide it.

Frequently asked questions

How do I read SharedPreferences without root?

Use the Device Explorer in Android Studio on a debug build to browse and pull the file. Production phones hide it. For release builds, add an in app export or read values through a backup of the app.

Is SharedPreferences the right place for tokens?

Yes for small flags and tokens, no for anything large or sensitive. Big blobs slow every read, and the file is only as safe as the app sandbox. Encrypted preferences or the Keystore fit secrets better.

Notice an outdated path? Let us know.