Could you list all possible directories where Android apps may store data, providing description what kind of data are stored in each directory?


All apps (root or not) have a default data directory, which is /data/data/<package_name>. By default, the apps databases, settings, and all other data go here. If an app expects huge amounts of data to be stored, or for other reasons wants to "be nice to internal storage", there's a corresponding directory on the SDCard (Android/data/<package_name>).

Apart from that, all apps can store data anywhere on the SDCard, as there are no restrictions -- and many apps do so. They can use directory names freely (and they again do), which is what often makes it hard to decide what all that "junk" on the card is intended for, and what of it can be deleted.

Though, as Tom pointed out, root-apps could store their data almost everywhere on your device, they usually follow the same rules as other apps.

You can find a general explanation of the Android directory hierarchy in my answer here. For your specific question I might add some more details on the /data/data/<package_name> (and corresponding SD-part):

  • databases/: here go the app's databases
  • lib/: libraries and helpers for the app
  • files/: other related files
  • shared_prefs/: preferences and settings
  • cache/: well, caches

There might be several more directories in this place, or fewer -- it all depends on the app. In its own "home directory" (and that's what it basically is, spoken Linux-wise) they can place files where they want. Usually, these files and directories are only accessible by the app itself (and root, of course) -- other than those stored on the SDCard, which are accessible by all apps.

| improve this answer | |
  • 1
    Is /data/data/<name>/files/ where files created as described in developer.android.com/guide/topics/data/… would go? I.e. those opened with FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);? – Nobody Feb 4 '18 at 17:27
  • An just in general, this is already a nice answer, but what about adding references to developer.android.com/guide/topics/data/… about which directory correlates to which abstract/path-agnostic description there? – Nobody Feb 4 '18 at 17:29
  • @Nobody 2) because that page is heavily developer oriented, while this site is end-user oriented? Same for 1) I'm no developer, and that asks for development details. Sorry. – Izzy Feb 5 '18 at 9:43
  • 1
    I do not have an SD card, and in my Android 6 and Android 7, Whatsapp stored lots of data in /storage/emulated/0/WhatsApp/ (subdirs .Shared, .trash, Backups, Databases, Media), including all media. I do not know if this is in addition to \data\data..., I cannot access this directory now. Maybe this changed among versions. – sancho.s ReinstateMonicaCellio Jul 4 '18 at 11:22
  • 1
    @Shayan the root directory (/) is not located on the SD card. SD Card means below /sdcard (internal card, points to /storage/emulated/<user>) or the corresponding path of your external card. And no, I cannot explain all possible location some app might use, sorry; AFAIK /data/misc is managed by the Android system itself, so "mere apps" should at best have read access there. Never encountered data/user_de (as it's a relative path, I don't know where you mean anyway). – Izzy Aug 6 '19 at 21:07

Some major changes occurred to storage in Android 4.4 (see Android's Storage Journey). So the following is generally true for Android 4.4+ and particularly 6+.

This is from my detailed answer to How disk space is used on Android device?. Apps files are saved (by system and app itself) to internal and external storage under different categories.

DIRECTORY                                                    DESCRIPTION / API
/data/app/<pkg>*                                             (user apps installation directory)
/data/app/<pkg>*/base.apk                                    (original `.apk` file)
/data/app/<pkg>*/lib/<arch>/*.so                             (shared libraries)
/data/app/<pkg>*/oat/<arch>/base.[art|odex|vdex]             (compiled executable code)
/data/dalvik-cache/<arch>/*.[art|dex|oat|vdex]               (compiled executable code, only for system apps)
/data/misc/profiles/cur/<user_id>/<pkg>/primary.prof         (ART profile)
/data/misc/profiles/ref/<pkg>/primary.prof                   (ART profile)

/data/user[_de]/<user_id>/<pkg>                              getDataDir
/data/user[_de]/<user_id>/<pkg>/files                        getFilesDir
/data/user[_de]/<user_id>/<pkg>/[code_]cache                 getCacheDir or getCodeCacheDir
/data/user[_de]/<user_id>/<pkg>/databases                    getDatabasePath
/data/user[_de]/<user_id>/<pkg>/no_backup                    getNoBackupFilesDir
/data/user[_de]/<user_id>/<pkg>/shared_prefs                 getSharedPreferences

/storage/emulated/obb/<pkg>/*.obb                            (shared by multi-users, exposed in following view)
/storage/emulated/<user_id>/Android/obb/<pkg>/*.<pkg>.obb    getObbDirs
/storage/emulated/<user_id>/Android/media/<pkg>              getExternalMediaDirs
/storage/emulated/<user_id>/Android/data/<pkg>/files         getExternalFilesDirs
/storage/emulated/<user_id>/Android/data/<pkg>/[code_]cache  getExternalCacheDirs
  • All of the above paths on internal and external storage (primary and secondary) are app's private directories which are accessible to respective app without requesting any permission. Apps can also create other directories (not explicitly available through APIs) in their private storage. All of these directories belonging to an app are deleted when app is uninstalled.
  • Additionally apps can put their data anywhere on primary external storage (including some standard directories and other apps' private directories) if WRITE_EXTERNAL_STORAGE permission is granted (getExternalStorageDirectory returns /storage/emulated/<user_id>). For secondary external storage and removable storage SAF is used. See details in How to move files to external SD card?.

    However in Android 10 writing directly to primary external shared storage is deprecated (getExternalStorageDirectory and getExternalStoragePublicDirectory are no more available). Apps need to use one of Android's built-in content providers; either MediaStore (for media files) or SAF (for any other type of files).

  • /data paths may get replaced with /mnt/expand/[UUID] when using Adoptable Storage. /storage/emulated gets replaced with /storage/[UUID] when using secondary external storage (like SD card).
  • For multiple users/profiles <user_id> is different, device owner is always 0. /data/user/0 is a symlink to /data/data for historical reasons. Secondary external storage is only available to device owner.
  • OBB directory is shared among users/profiles (up to Android 9) to save space. FUSE/sdcardfs always exposes /storage/emulated/obb as /storage/emulated/<user_id>/Android/obb.
  • /data/user_de is the Device Encrypted storage on FBE devices which lets certain apps run on boot without asking for user credentials.
  • /data/misc/profiles are used by ART for profile-guided compilation of app code.
  • Description of each directory is somewhat evident from names, details can be seen in API documentation.
    • Caches are cleared by OS when running low on storage, keeping apps exceding allotted quota on top.
    • Apps' private files directories aren't automatically scanned by MediaScanner but media directories are.
    • Files in no_backup directory are not backed up to cloud.
| improve this answer | |
  • @Firelord thanks for the reward – Irfan Latif Apr 19 at 21:40
  • 1
    You deserved it. :-) – Firelord Apr 19 at 22:13

The answer to your question you are asking is too big. I can, however, give you a basic answer which covers the basics.

There are two kinds of apps:
Root and non-root.

Root apps can basically store/modify files wherever they want.

Non-root apps can only store/modify files here: /sdcard/ and every folder what comes after.
Mostly, the installed apps store themselves at /sdcard/Android/data or /sdcard/Android/obb.
Some apps store their save games/configuration data files on /sdcard/APPNAME/, or just on the /sdcard/

To be able to use root apps, you'll need to have rooted your Android device and have given permission from one of the superuser apps.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.