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

前端 未结 14 1798
长发绾君心
长发绾君心 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条回答
  •  佛祖请我去吃肉
    2020-11-30 17:28

    On MacOSX, by combining the answers from Calaf and Ollie Ford, the following worked for me.

    On the command line (be sure adb is in your path, mine was at ~/Library/Android/sdk/platform-tools/adb) and with your android device plugged in and in USB debugging mode, run:

     adb backup -f backup com.mypackage.myapp
    

    Your android device will ask you for permission to backup your data. Select "BACKUP MY DATA"

    Wait a few moments.

    The file backup will appear in the directory where you ran adb.

    Now run:

    dd if=backup bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar
    

    Now you'll you have a backup.tar file you can untar like this:

     tar xvf backup.tar
    

    And see all the files stored by your application.

提交回复
热议问题