Skip to content

Instantly share code, notes, and snippets.

@macu
Created October 13, 2016 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macu/94d9fc07069c63ee85e391d531a4daa3 to your computer and use it in GitHub Desktop.
Save macu/94d9fc07069c63ee85e391d531a4daa3 to your computer and use it in GitHub Desktop.
Copy database from actual device to VM for testing
# Ensure all AVDs are closed, and your Android device is connected.
# To make a backup of the ca.mattcudmore.day2day app:
~/Library/Android/sdk/platform-tools/adb backup -f backup.ab ca.mattcudmore.day2day
# Convert the backup file to TAR:
dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar
# Extract the TAR to access files.
tar -xvf backup.tar
# Now disconnect Android device and launch AVD where files will be copied to.
# For copying a database file from the extracted TAR into place, for example:
~/Library/Android/sdk/platform-tools/adb push example.db /data/data/ca.mattcudmore.day2day/databases/example.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment