首页 > 代码库 > adb 命令记录
adb 命令记录
adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。
发广播
adb shell am broadcast -a com.vanzo.change.navigationbar.layout --ez back_on_right false
通过命令行执行adb shell am broadcast发送广播通知。
adb shell am broadcast 后面的参数有:
[-a <ACTION>]
[-d <DATA_URI>]
[-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>]
[-f <FLAGS>] [<URI>]
例如:
adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true
说明:蓝色为key,红色为value,分别为String类型,int类型,boolean类型
adb logcat -b all -v time >log.txt
adb shell dmesg >dmesg.txt
adb logcat -b main -b system -b events -b radio -v time
adb shell cat /proc/kmsg > kmsg.txt
抓取log.
usb 连接 插上手机 lsusb 查看设备ID
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 093a:2521 Pixart Imaging, Inc.
Bus 003 Device 003: ID 045e:0750 Microsoft Corp. Wired Keyboard 600
Bus 001 Device 003: ID 05e3:0723 Genesys Logic, Inc. GL827L SD/MMC/MS Flash Card Reader
然后在 .android/adb_usb.ini 里面添加设备ID 0x05e3
修改一下 ATTR{idProduct}=="9020"
sudo vim /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", ATTR{idProduct}=="9020", MODE="0777", OWNER="**********"
adb shell
1proc/mtkdev
Boardinfo:
CPU: MT6735M
LCM: otm8019a_auo45_ykl_fwvga
TP: GT9XX_hotknot
CAM: ov5670mipiraw
CAM2: gc2755mipiraw
2 写入节点值
如 /sys/devices/bus.2/11008000.I2C1/i2c-1/1-005d/gesture
echo 1 > /sys/devices/bus.2/11008000.I2C1/i2c-1/1-005d/gesture
3 查看apk 包名 信息
aapt d badging apk 名
模拟开机动画播放
adb shell 进入adb后,执行下面两句就可以播放开机动画了,呵呵
setprop service.bootanim.exit 0
setprop ctl.start bootanim
退出的话执行
setprop service.bootanim.exit 1
getevent
pm list package -f 查看手机中的包名
上面也就是一些比较实用的adb 命令。总结一下保存下来。
adb 命令记录