LoginSignup
6
2

More than 5 years have passed since last update.

カスタムのadbコマンドを追加する

Last updated at Posted at 2018-01-15

はじめに

Android開発をしていると、よく画面のスクリーンショットを撮ったり、アプリの挙動を録画したい事があります。今までは、適当な場所にadb-screen-shot.shadb-record.shを置いて、パスを通して、adb-screen-shot.shadb-record.shという風に使っていました。
これをadb snapでスクリーンショットを撮ったり、adb recordで画面を録画できたらいいなと思いました。

方法

~/.zshrcを編集します。

vim ~/.zshrc

↓を追加します。

adb() {
    if [[ $@ == "snap" ]]; then
        command /your/path/to/adb-screenshot.sh
    elif [[ $@ == "record" ]]; then
        command /your/path/to/adb-screen-record.sh
    else
        command adb "$@"
    fi
}

これで、adb snapでスクリーンショットを撮ったり、 adb recordで画面を録画したりできます。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2