开发最常用的 adb 命令
启动停止服务
adb start-server
adb kill-server
安装卸载应用
adb install /Users/compass/Desktop/app/app.apk
adb -s xxx install /Users/compass/Desktop/app/app.apk
adb install -r /Users/compass/Desktop/app/app.apk
adb install -t /Users/compass/Desktop/app/app.apk
adb uninstall com.example.app
系统信息
adb devices
adb version
adb shell settings get secure android_id
adb shell getprop ro.build.version.release
修改分辨率
adb shell wm size
adb shell wm size 1080x1920
adb shell wm size reset
修改屏幕密度
adb shell wm density
adb shell wm density 480
adb shell wm density reset
查看当前活动窗口的类名
adb shell dumpsys window windows | findstr mCurrentFocus
adb shell dumpsys window windows | grep mCurrentFocus
电脑和手机互传文件
adb push /Users/compass/Desktop/app/app.apk /sdcard/
adb pull /sdcard/app.apk /Users/compass/Desktop/app/
收集日志
adb logcat -v time > /Users/compass/Desktop/log.txt
adb logcat -v time | grep -i "crash"
adb logcat > log.txt
启动应用
adb shell am start -n com.example.app/com.example.app.MainActivity
adb shell am start -n com.example.app/com.example.app.MainActivity --es "key" "value"