This answer is based on my experience with other answers and comments in the answers. I hope that I can help someone in a similar situation.
I do this on OSX via terminal.
Vinicius Avellar's answer worked fine for me before. I only ever most of the time needed a database from a device from a debugging application.
Today I had a use case where I needed several personal files . I ended up with two solutions that worked well for this case.
Use the accepted answer along with some Someone Somewhere OSX special comments. Back up and use a third-party solution, sourceforge.net/projects/adbextractor/files/?source=navbar to unzip to tar. I will write more about my experience with this solution at the bottom of this answer. Scroll down if this is what you are looking for.
Faster solution I agreed with. I created a script to pull out several files similar to Tamas answer. I can do it this way because my application is a debugging application and I have run-as on access to my device. If you do not have access to run, because this method will not work for you on OSX.
Here is my script for pulling out a few personal files that I will share with you, a reader who is also exploring this amazing question;):
#!/bin/bash # # Strict mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/ set -euo pipefail IFS=$'\n\t' # # Usage: script -f fileToPull -p packageName # # This script is for pulling private files from an Android device # using run-as. Note: not all devices have run-as access, and # application must be a debug version for run-as to work. # # If run-as is deactivated on your device use one of the # alternative methods here: # http://stackoverflow.com/questions/15558353/how-can-one-pull-the-private-data-of-ones-own-android-app # # If you have encrypted backup files use: # sourceforge.net/projects/adbextractor/files/?source=navbar # From comments in the accepted answer in the above SO question # # If your files aren't encrypted use the accepted answer # ( see comments and other answers for OSX compatibility ) # # This script is open to expansions to allow selecting # device used. Currently first selected device from # adb shell will be used. #Check we have one connected device adb devices -l | grep -e 'device\b' > /dev/null if [ $? -gt 0 ]; then echo "No device connected to adb." exit 1 fi # Set filename or directory to pull from device # Set package name we will run as while getopts f:p: opt; do case $opt in f) fileToPull=$OPTARG ;; p) packageName=$OPTARG ;; esac done; # Block file arg from being blank if [ -z "$fileToPull" ]; then echo "Please specify file or folder to pull with -f argument" exit 1 fi # Block package name arg from being blank if [ -z "$packageName" ]; then echo "Please specify package name to run as when pulling file" exit 1 fi # Check package exists adb shell pm list packages | grep "$packageName" > /dev/null if [ $? -gt 0 ]; then echo "Package name $packageName does not exist on device" exit 1 fi # Check file exists and has permission with run-as fileCheck=`adb shell "run-as $packageName ls $fileToPull"` if [[ $fileCheck =~ "Permission denied" ]] || [[ $fileCheck =~ "No such file or directory" ]]; then echo "Error: $fileCheck" echo "With file -> $fileToPull" exit 1 fi # Function to pull private file # # param 1 = package name # param 2 = file to pull # param 3 = output file function pull_private_file () { mkdir -p `dirname $3` echo -e "\033[0;35m***" >&2 echo -e "\033[0;36m Coping file $2 -> $3" >&2 echo -e "\033[0;35m***\033[0m" >&2 adb shell "run-as $1 cat $2" > $3 } # Check if a file is a directory # # param 1 = directory to check function is_file_dir() { adb shell "if [ -d \"$1\" ]; then echo TRUE; fi" } # Check if a file is a symbolic link # # param 1 = directory to check function is_file_symlink() { adb shell "if [ -L \"$1\" ]; then echo TRUE; fi" } # recursively pull files from device connected to adb # # param 1 = package name # param 2 = file to pull # param 3 = output file function recurse_pull_private_files() { is_dir=`is_file_dir "$2"` is_symlink=`is_file_symlink "$2"` if [ -n "$is_dir" ]; then files=`adb shell "run-as $1 ls \"$2\""` # Handle the case where directory is a symbolic link if [ -n "$is_symlink" ]; then correctPath=`adb shell "run-as $1 ls -l \"$2\"" | sed 's/.*-> //' | tr -d '\r'` files=`adb shell "run-as $1 ls \"$correctPath\""` fi for i in $files; do # Android adds nasty carriage return that screws with bash vars # This removes it. Otherwise weird behavior happens fileName=`echo "$i" | tr -d '\r'` nextFile="$2/$fileName" nextOutput="$3/$fileName" recurse_pull_private_files "$1" "$nextFile" "$nextOutput" done else pull_private_file "$1" "$2" "$3" fi } recurse_pull_private_files "$packageName" "$fileToPull" "`basename "$fileToPull"`"
Essence: https://gist.github.com/davethomas11/6c88f92c6221ffe6bc26de7335107dd4
Return to method 1 , decrypt backup using Android Backup Extractor
Here are the steps I took on my Mac and the problems I encountered:
First I queued a backup (and set a password to encrypt my backup, my device required it):
adb backup -f myAndroidBackup.ab com.corp.appName
The second I downloaded only abe.jar from here: https://sourceforge.net/projects/adbextractor/files/abe.jar/download
Next I ran:
java -jar ./abe.jar unpack myAndroidBackup.ab myAndroidBackup.tar
At this point, I received an error message. Since my archive is encrypted, java gave me the error that I needed to install some security policy libraries.
- So, I went to http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html and downloaded the security banks I needed. Now in my case, the installation instructions told me the wrong location to put the jar files. It states that the correct location is <java-home> / lib / security . I put them there first and still got an error message. So I researched, and on my Mac with Java 1.8, the right place to host them was: <java-home> / jre / lib / security . I made a backup of the original policy flags and put them there. Vola I was able to enter the password using abe.jar and decrypt the tar file.
Finally, I just ran (after re-executing the previous command)
tar xvf myAndroidBackup.tar
Now itβs important to note that if you can just run like a cat, itβs much faster. First, you only get the files you want, not the whole application. Two, the more files (+ encryption for me) slows down the transfer. Therefore, knowing this method is important if you are not running, as in OSX, but the script should be the first goto for the debugging application.
Remember, I just wrote it today and tested it several times, so please let me know about the errors!