How can one pull the (private) data of one's own Android app?

前端 未结 14 1801
长发绾君心
长发绾君心 2020-11-30 16:44

Attempting to pull a single file using

adb pull /data/data/com.corp.appName/files/myFile.txt myFile.txt

fails with

failed          


        
14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 17:14

    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 and zlib doesn't work on Mac)

    1. Take a backup of your app's data directory adb backup -f /Users/username/Desktop/data.ab com.example

    2. 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?

    3. Once successfully backed up, you will see data.ab file in your Desktop. Now we need to convert this to tar format.

    4. Use Android Backup Extractor for this. Download | SourceCode

    5. Download it and you will see abe.jar file. Add this to your PATH variable.

    6. Execute this to generate the tar file: java -jar abe.jar unpack /Users/username/Desktop/data.ab /Users/username/Desktop/data.tar

    7. Extract the data.tar file to access all the files

提交回复
热议问题