Today I learned I should include the app package name after shell in my ADB command, if for example I want to list files under the “subdirectory/media” directory of an app, like so:
adb -s emulator-5556 shell run-as com.domain.my.app ls -al /data/user/0/com.domain.my.app/subdirectory/media
First try’s command below failed with a Permission Denied error message:
adb -s emulator-5556 shell ls -al /data/user/0/com.domain.my.app/subdirectory/media
Makes sense, right? Because part of Android OS’ security is limiting access to app directories. But if you “run-as” the package owner app itself, it should grant you access.
Related Posts
The homo sapiens behind these blog posts is “Catzie“
An odd human being who happens to have a variety of ever-changing interests, but these days she is often caught coding (Web and Android App Developer for a total of 14+ years!), optimizing this blog, tweaking a Traveler’s Notebook, refilling a cheap fountain pen, making up silly song/rap lyrics, watching K-pop performances, concocting unusual dessert/drink flavors, making scented candles, drawing, painting water-based mixed media pieces, obsessing about how some things works and what unfamiliar words mean, automating repetitive chores, anime, video games… Ran online dessert shops Cookies PH and Catzie’s Cakery in her past life.