Skip to content

Instantly share code, notes, and snippets.

@jhelwig
Created July 15, 2012 17:25
Show Gist options
  • Save jhelwig/3117790 to your computer and use it in GitHub Desktop.
Save jhelwig/3117790 to your computer and use it in GitHub Desktop.
Android CLI helpers
#!/bin/bash
# This assumes that there is a file named .activity-to-launch where the sole
# contents are the name of the activity to launch on each device.
#
# For example:
# net.technosorcery.rally.ts_200/net.technosorcery.rally.ts_200.MainActivity
ant clean
start_activity="$(cat .activity-to-launch)"
for device in `adb devices | egrep -v '^List' | grep -v '^$' | cut -f1 | sort`; do
env ANDROID_SERIAL=${device} ant debug install
env ANDROID_SERIAL=${device} adb shell am start -n "${start_activity}"
done
#!/bin/bash
# This assumes that it has full control over the window specified by
# $tmux_window, and can destroy & recreate it at will.
tmux_window=":1"
tmux new-window -dk -n logcat -t ${tmux_window}
for device in `adb devices | egrep -v '^List' | grep -v '^$' | cut -f1 | sort`; do
tmux split-window -dv -t ${tmux_window} "env ANDROID_SERIAL=${device} adb logcat"
done
tmux kill-pane -t ${tmux_window}.1
tmux select-layout -t ${tmux_window} even-horizontal
tmux select-pane -t ${tmux_window}.1
tmux select-window -t ${tmux_window}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment