Android基础-基本的Adb命令
Adb常用命令
- adb服务开启关闭
1 | adb start-server #开启 |
- adb安装/卸载apk
1 | adb install apk文件.apk #安装 |
多个设备要加上参数-s 设备号
1 | adb -s deviceNo install apk文件.apk |
启动Activity/Service
1
2adb shell am start 包名/Activity类名
adb shell am startservice 包名/Service类名传输文件到手机
1
adb push localFile /sdcard/download/
截屏/录屏
1
2adb shell screencap /sdcard/image.png # 截屏
adb shell screenrecord /sdcard/vedio.mp4 # 录屏发送aaa文本到手机输入框
1 | adb shell input text "aaa" |
- 显示activity任务栈
1 | adb shell dumpsys activity |
- 查看证书签名
1
2
3keytool -list -v -keystore .\key.jks # 有密钥文件,并且有密码
keytool -printcert -file CERT.RSA # 查看apk包解压获取RSA文件
刷机
- adb 重启
1 | adb reboot # 简单的重启 |
- fastboot
1
2
3fastboot flash boot boot.img # 写入新的bootloader
fastboot flash recovery recovery.img # 写入新的recovery
fastboot oem unlock #解锁