最終更新:2021-11-24 (水) 19:45:11 (1180d)
adb
Top / adb
Android Debug Bridge
開発環境からAndroid端末を操作するコマンド
使い方
- USBデバッグ設定が有効になっているAndroid端末とPCをUSBケーブルでつなぐ
パス
Windows
- %LOCALAPPDATA%\Android\Sdk\platform-tools
Linux
- $HOME/Android/Sdk/platform-tools/adb
シェル
Windows 7のcmd
- 上下でコマンド履歴をたどれる
- 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 helpで使い方を表示。
コマンド 説明 adb devices デバイス一覧 adb connect <host:port> 接続 adb disconnect <host:port> 切断
デバイスコマンド
コマンド 説明 adb push {localfile} {devicepath} デバイスにファイルを転送 adb pull {devicefile} {localpath} デバイスからファイルを転送 adb sync? copy host->device only if changed (-l means list but don't copy) adb shell Android端末のシェルへ adb shell top adb shell procrank adb shell df / adb emu <command> run emulator console command adb logcat デバイスログを見る adb forward <local> <remote> ソケット接続をフォワード adb jdwp list PIDs of processes hosting a JDWP transport adb install {apkfile} adb uninstall {packagename} adb bugreport return all information from the device adb backup write 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-server ensure that there is a server running adb kill-server kill 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 remount remounts 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 root restarts 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
ネットワーキング
Android 4.1からの新機能
その他
- adb hell
- adb lolcat
ネットワーク経由でADB接続
http://developer.android.com/guide/topics/connectivity/usb/index.html
adb tcpip 5555 adb connect <device-ip-address>:5555
USB接続に戻す
- adb usb?
メモ
- PTPモードにしないと認識されなかった。