查看已连接的设备
adb devices
登录设备 shell
adb shell
adb shell -s your_device_id
安装应用
adb install your_apk_file
adb install -r your_apk_file
卸载应用
adb uninstall your_apk_name
在 shell 里启动应用
adb shell am start -n your.app.package/.MainActivity
执行一些操作
adb shell input keyevent keyevent_number
Telephony Log
adb logcat -b radio -v time
adb logcat -b system -b main -b radio -b events -v time
adb logcat -b system -b main -b radio -b events -v threadtime
adb logcat -v time -s pppd
AP Log
/* init.rc */
service logcat-debug /system/bin/logcat -b system -b main -b radio -b events -n 20 -r 4096 -v threadtime -f /data/logs/debug.log
IP Log
- 在 Termianl 1 里用 tcpdump 抓取 iplog
adb shell
adb root
adb remount
adb shell
tcpdump -i any -s 0 -w /data/logs/iplog.pcap &
- 在 Terminal 2 里把 IP Log 抓取到本地
mkdir ip_logs
cd ip_logs
adb pull /data/logs ./
- 用 wireshark 进行分析
wireshark iplog.pcap
过滤日志
adb logcat -s your_tag_name
adb logcat -s your_tag_name_1 your_tag_name_2
adb logcat "*:priority"
V — Verbose (lowest priority)
D — Debug
I — Info
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever printed)
adb logcat -s your_tag_name:priority
adb logcat -s your_tag_name_1:priority your_tag_name_2:priority
adb logcat | grep "search_term"
adb logcat | grep "search_term_1\|search_term_2"
清除 logcat buffer
adb logcat -c
WiFi 无线调试
- 手机上的操作
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
- 电脑上的操作
adb connect 192.168.13.218:5555
adb shell
用 busybox 来 mount 文件夹
adb push busybox-armv7l /sdcard/busybox
adb shell
su
cd /sdcard/busybox
chmod 755 busybox
busybox mount -o remount,rw /system
扩展阅读