Attempting to pull a single file using
adb pull /data/data/com.corp.appName/files/myFile.txt myFile.txt
fails with
failed to copy '/data/data/com.corp.appName/files/myFile.txt myFile.txt' to 'myFile.txt': Permission denied
despite that USB debugging is enabled on the device.
We can go around the problem through the archaic route
adb shell
run-as com.corp.appName
cat files/myFile.txt > myFile.txt
but this is unwieldy for more than one file.
How can I pull the directory /data/data/com.corp.appName/files to my MacBook?
Doing this either directly or through a transit in `/storage/sdcard0/myDir (from where I can continue with Android File Transfer) is fine.
Additional Comment
It may be that just running
adb backup -f myFiles com.corp.appName
will generate the files I am looking for. In that case I am looking for a way to untar/unzip the resulting backup!
you can do:
Here is what worked for me:
I'm printing the database directly into local file.
If you are using a Mac machine and a Samsung phone, this is what you have to do (since
run-as
doesn't work on Samsung andzlib
doesn't work on Mac)Take a backup of your app's data directory
adb backup -f /Users/username/Desktop/data.ab com.example
You will be asked for a password to encrypt in your Phone, don't enter any. Just tap on "Back up my data". See How to take BackUp?
Once successfully backed up, you will see
data.ab
file in your Desktop. Now we need to convert this totar
format.Use Android Backup Extractor for this. Download | SourceCode
Download it and you will see
abe.jar
file. Add this to your PATH variable.Execute this to generate the tar file:
java -jar abe.jar unpack /Users/username/Desktop/data.ab /Users/username/Desktop/data.tar
Extract the data.tar file to access all the files
I had the same problem but solved it running following:
After this you can run
Similar to Tamas's answer, here is a one-liner for Mac OS X to fetch all of the files for app with
your.app.id
from your device and save them to (in this case)~/Desktop/your.app.id
:-d
to pull from emulatorBacked up Game data with apk. Nougat Oneplus 2.