Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

adb

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?

like image 812
Leem.fin Avatar asked Nov 10 '22 12:11

Leem.fin


1 Answers

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.

like image 91
Robert Avatar answered Nov 14 '22 21:11

Robert