Skip to content

Instantly share code, notes, and snippets.

@morganestes
Created June 10, 2014 21:23
Show Gist options
  • Select an option

  • Save morganestes/ad6f90f0aa50d6948acd to your computer and use it in GitHub Desktop.

Select an option

Save morganestes/ad6f90f0aa50d6948acd to your computer and use it in GitHub Desktop.
Android command-line tools for OS X.
# Android helpers
alias phonescreencap="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png"
# Creates a full backup using adb.
function phonebackup(){
local timestamp=$(date "+%Y%m%dT%H%M%S")
local phoneserial=$(adb get-serialno)
adb backup -apk -shared -all -f "${HOME}/temp/villebackup/${phoneserial}-backup-${timestamp}.ab"
}
# Uses Android Backup Extractor to extract the .ab file created by phonebackup
# Requires JRE 1.7 or greater.
# abe.jar built from source at https://github.com/nelenkov/android-backup-extractor
# I put mine in ~/bin, and I'm using the homebrew cask java7 package.
# This works on my HTC One S (ville) running CyanogenMod (CM11).
function phonebackupextract(){
local backup=$1
java -jar ~/bin/abe.jar unpack "$backup" "$backup.tar"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment