adb -d shell "run-as ..." not working on Android O

Viewed 2228

Has something changed that commands like the following below no longer work on Android O?

adb -d shell "run-as package.name cat /data/data/package.name/databases/foo.db" > foo.db

Running:

  • Build: OPP2.170420.019
  • Device: Nexus 6P

I have tried endless amounts of ways but even cat or cp to the /sdcard does nothing. I am guessing some permission has changed and we can no longer use run-as package.name.

The only way that I am able to get data from my non-rooted Android O device is to use a FileProvider and copy to the /sdcard.

Does anyone have success using run-as on a debug package? Anyone having the same issues as I am?

2 Answers

Looks like run-as will set current directory to /data/data/packageName.

I think the following would work:

adb -d shell "run-as package.name cat databases/foo.db" > foo.db

Related