最終更新:2021-11-24 (水) 19:45:11 (883d)  

adb
Top / adb

Android Debug Bridge

開発環境からAndroid端末を操作するコマンド

使い方

  • USBデバッグ設定が有効になっているAndroid端末とPCをUSBケーブルでつなぐ

パス

Windows

Linux

  • $HOME/Android/Sdk/platform-tools/adb

シェル

Windows 7cmd

  • 上下でコマンド履歴をたどれる
  • Tabもきく
  • ウィンドウサイズの調整がいまいち

Cygwin

  • 上下でコマンド履歴をたどれない
  • Tabもきかない

ADB enhanced PuTTY

  • usb-transport
  • 動かなかった。

PuTTY Tray

  • 動いた

Android 6.0

  • 通知からUSBのモードをPTPに切り替える必要がある

Ubuntu/パッケージ

接続

  • adb -s <specific device>
  • adb -a - すべてのインターフェイス
  • adb -d - USB接続のデバイスのみ
  • adb -e - エミュレータのみ

複数台つながってる時

  • adb -s emulator-5554 shell

コマンド

デバイスコマンド

  • コマンド説明
    adb push {localfile} {devicepath}デバイスにファイルを転送
    adb pull {devicefile} {localpath}デバイスからファイルを転送
    adb sync?copy host->device only if changed (-l means list but don't copy)
    adb shellAndroid端末のシェルへ
    adb shell top
    adb shell procrank
    adb shell df /
    adb emu? <command>run emulator console command
    adb logcatデバイスログを見る
    adb forward <local> <remote>ソケット接続をフォワード
    adb jdwplist PIDs of processes hosting a JDWP transport
    adb install {apkfile}
    adb uninstall {packagename}
    adb bugreportreturn all information from the device
    adb backupwrite an archive of the device's data to <file>
    adb restore? <file>restore device contents from the <file> backup archive
    adb help
    adb version?

スクリプティング

  • adb wait-for-device?block until device is online
    adb start-serverensure that there is a server running
    adb kill-serverkill the server if it is running
    adb get-state?prints: offline , bootloader , device
    adb get-serialno?prints: <serial-number>
    adb status-window?continuously print device status for a specified device
    adb remountremounts the /system partition on the device read-write
    adb reboot [bootloader or recovery]reboots the device, optionally into the bootloader or recovery program
    adb reboot-bootloader?
    adb rootrestarts the adbd daemon with root permissions
    adb usb?restarts the adbd daemon listening on USB
    adb tcpip <port>restarts the adbd daemon listening on TCP on the specified port

ネットワーキング

  • adb ppp?
    adb sync?

Android 4.1からの新機能

その他

  • adb hell
  • adb lolcat

ネットワーク経由でADB接続

USB接続に戻す

  • adb usb?

メモ

  • PTPモードにしないと認識されなかった。

ソースコード

一覧に出ない時

Ubuntu/パッケージ

よく使うadbのコマンド

関連

参考