Device App Directories
For a typical Android application, the files are primarily stored in dedicated locations in the /data partition of the device. You will need to be root to access these directories.
This is focused on user installed applications, not the included system apps.
App Code & Optimized Files
The core code of the app, and the optimized/verified files are stored in the following directories. In Android, the core code is considered the .apk file, and the optimized/verified files are stored in the .odex, .vdex, & .oat files.
The main installation directory for user installed apps is /data/app/<hash>/<package-id>-<hash>/. This is where the .apk file is stored along with the .odex/.vdex files.
|---base.apk
|---lib
| |---arm64
| | |---libc++_shared.so
| | |---libsieve.so
|---oat
| |---arm64
| | |---base.odex
| | |---base.vdex
You can get the exact location using the pm command:
pm path <package-id>
For example, this is the command that I used on my rooted device for the Sieve app:
oriole:/ # pm path com.withsecure.example.sieve
package:/data/app/~~ovfqR9Q6QNa1kcrfGfjv0g==/com.withsecure.example.sieve-j9D1Ho5XAUG5vUk6EmVXcQ==/base.apk
lib Directory
Inside the lib directory, you will find the shared libraries for the app under a sub-directory of the architecture. In my case, the architecture is arm64.
oat Directory
This subdirectory holds the optimized code files generated by the ART runtime for specific CPU architectures.
base.odex or base.oat: Contains the Ahead-of-Time (AOT) compiled native machine code for the app's DEX files.
base.vdex: Contains the uncompressed, verified DEX bytecode and verification metadata.
App Data (Internal Storage)
Each app has a private sandbox directory on the internal storage for its data, which is inaccessible to other apps and users without root access.
Typically stored at /data/data/<package-id> or /data/user/<uid>/<package-id>. Most devices are considered "single-user" devices, which means there is only one user ID, which means that in most cases /data/data/<package-id> will be used. In either case, the directory structure is the same:
|---cache
|---code_cache
|---databases
| |---database.db
| |---database.db-journal
|---files
| |---profileInstalled
|---no_backup
|---shared_prefs
This is the private internal data directory. Key subdirectories include:
databases/: Stores SQLite database files used by the application.shared_prefs/: Stores XML files for SharedPreferences, used for small key-value settings.files/: For general, persistent files that don't fit into other categories.cache/: For temporary cached data that the system can clear if storage runs low.lib/: In some configurations, this might contain additional libraries.
App Data (External Storage)
Apps can store non-sensitive data on external storage (like an SD card or a portion of internal memory configured as such).
/storage/self/primary/Android/data/<package_name>/: This is the app-specific directory on external storage. Files here are intended for the app's sole use and are deleted when the app is uninstalled on newer Android versions (Android 11+).- This directory is accessible at the symbolic link
/sdcard/Android/data/<package-id>/
- This directory is accessible at the symbolic link
files/: App-specific persistent files on external storage.cache/: App-specific cache files on external storage.
External storage directories are available to all apps on the device. Therefore, it is essential that the app does not store any sensitive information in this location.