Leem.fin
Leem.fin

Reputation: 42582

Use adb pull to copy app's file from phone (not rooted)

I am using a MacBook as my development machine. My Android phone is not rooted. I want to copy my Android app's file from phone to my MacBook. I tried the following:

  1. Connect Android phone to MacBook (Developer's option is enabled)

  2. adb pull /data/data/com.my.app/app_data/data ~/Documents/my/app/

where /data/data/com.my.app/app_data/data is the file path on phone, and ~/Documents/my/app/ is the directory path on MacBook.

But the above adb pull command shows Permission denied.

I also tried to use su under adb shell, but it doesn't work either:

~$ adb shell
shell@xyz:/ $ su
/system/bin/sh: su: not found

So, how can I copy my app's internal file to my MacBook directory?

Upvotes: 5

Views: 8913

Answers (2)

Robert
Robert

Reputation: 42575

On a non-rooted phone you can not access the app private data directory (/data/data/com.my.app).

The only way to extract the data is to create a backup of the app data using adb backupp:

adb backup -f mybackup.ab com.my.app

For extracting the information from the created backup archive you can use the Android Backup Extractor. It converts the Android backup archive to a tar archive file.

Note: If the app specifies in it's manifest that backup is disallowed the described way does not work. In such a case the only way is to root the phone.

Upvotes: 1

Héctor
Héctor

Reputation: 26034

You have to navigate to your file with adb shell.

Then copy to sdcard:

cat yourfile > /sdcard/yourfile

Then exit from adb shell and now you can pull:

adb pull /sdcard/yourfile

Upvotes: 1

Related Questions