Skip to content

Instantly share code, notes, and snippets.

@dskinner
Created November 23, 2015 15:41
Show Gist options
  • Save dskinner/ae723c97ea8ac60ddb58 to your computer and use it in GitHub Desktop.
Save dskinner/ae723c97ea8ac60ddb58 to your computer and use it in GitHub Desktop.
godroid.sh
#! /usr/bin/env bash
function usage {
echo "Usage: godroid [...command]"
echo " build build -target android ."
echo " install install -r *.apk"
echo " run run Activity"
echo " logcat filter by tag GoLog since now()"
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
for var in "$@"; do
case "$var" in
build)
gomobile build -target android .
;;
install)
adb install -r *.apk
;;
run)
adb shell am start -n `aapt d badging *.apk | awk -F \' '/package/{printf $2"/"};/launchable/{print $2}'`
;;
logcat)
adb logcat -T 1 GoLog:V *:S
;;
*)
usage
exit 1
;;
esac
if [ $? -ne 0 ]; then
exit $?
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment