Skip to content

Instantly share code, notes, and snippets.

@hackugyo
Created November 8, 2012 09:47
Show Gist options
  • Save hackugyo/4037845 to your computer and use it in GitHub Desktop.
Save hackugyo/4037845 to your computer and use it in GitHub Desktop.
Androidアプリをビルドして起動するスクリプト(複数実機対応) ref: http://qiita.com/items/3942bb6b1d6eb8a7da46
MY_DIRNAME=$(dirname $0)
cd $MY_DIRNAME
cd YOUR_APP_DIR
echo "インストール先を選んでください"
# sedで余計な文字列を削除し,selectでANSに選ばれた選択肢を入れる
select ANS in `adb devices | sed -e "s/List of devices attached//" | sed -e "s/device//"`
# 入力値が適切な値かどうかチェック
do
if [ -z "$ANS" ]; then
continue
else
break
fi
done
echo $ANS
# debugbuildしてインストール
# http://www.alittlemadness.com/2010/06/15/android-ant-builds-targeting-a-specific-device/
export ANDROID_SERIAL=$ANS
ant debug install
# 起動
adb -s $ANS shell am start -a android.intent.action.MAIN -n YOUR_MAIN_ACTIVITY
# BUILD FAILEDなどを見るために,ターミナルを閉じずにキー入力を待つ
read null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment