Android ADB run-as to view app files
While deploying a .NET MAUI app to my Android emulator I wanted to verify that the SQLite database file had been created. Running adb root
doesn’t work on a production build (what I assume the emulator version to be). Instead, you can use the run-as
command to view the files.
C:\Users\niklas\source\repos\Playground\MyApp\AppUI>adb -e shell
emu64x:/ $ run-as com.my.app ls -l /data/data/com.my.app
total 32
drwxrws--x 3 u0_a162 u0_a162_cache 4096 2024-11-01 19:39 cache
drwxrws--x 2 u0_a162 u0_a162_cache 4096 2023-04-15 22:16 code_cache
drwxrwxrwx 6 u0_a162 u0_a162 4096 2024-11-03 19:27 files
drwxrwx--x 2 u0_a162 u0_a162 4096 2023-07-17 10:14 shared_prefs
emu64x:/ $ run-as com.my.app ls -l /data/data/com.my.app/files
total 44
-rw------- 1 u0_a162 u0_a162 0 2024-10-06 22:20 profileInstalled
-rw------- 1 u0_a162 u0_a162 36864 2024-11-03 19:03 myapp.db3
emu64x:/ $
Reference: ADB access denied to data folder?