Skip to content

Instantly share code, notes, and snippets.

@lifecube
Created August 13, 2014 10:30
Show Gist options
  • Select an option

  • Save lifecube/b8390a5290e272fe5f25 to your computer and use it in GitHub Desktop.

Select an option

Save lifecube/b8390a5290e272fe5f25 to your computer and use it in GitHub Desktop.
pull out android db file to current folder
ADB="/Applications/Android\ Studio.app/sdk/platform-tools/adb"
ADB_SHELL="$ADB shell"
SELF=`basename $0`
DEST_DIR="./"
if [ $# -ne 2 ]
then
echo "Usage: $SELF [PACKAGE.NAME [DB_FILE]]"
echo "eg. $SELF com.mydomain.myapp names.db"
exit 0
fi;
cmd_chmod="$ADB_SHELL 'run-as $1 chmod 666 /data/data/$1/databases/$2' "
cmd_pull="$ADB pull /data/data/$1/databases/$2 $DEST_DIR"
eval $cmd_chmod
eval $cmd_pull
err=$?
if [ $err -eq 0 ]
then
echo "Done: ADB pull"
else
echo "Failed: ADB pull"
exit err
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment