2020-11-04 20:12:56 +00:00
|
|
|
# adb shell
|
|
|
|
|
|
|
|
> 安卓调试桥-Shell: 运行安卓模拟器或者连接设备上的远程终端命令。
|
2021-08-02 09:41:09 +01:00
|
|
|
> 更多信息: <https://developer.android.com/studio/command-line/adb>.
|
2020-11-04 20:12:56 +00:00
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 启动模拟器/设备上的远程终端:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 获取模拟器/设备全部属性:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell getprop`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 重置所有运行时权限为它们的默认值:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell pm reset-permissions`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 撤销一个应用的危险权限:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell pm revoke {{包名}} {{权限}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 触发一个键盘敲击事件:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
2021-04-04 01:08:57 +01:00
|
|
|
`adb shell input keyevent {{键位码}}`
|
2020-11-04 20:12:56 +00:00
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 清除模拟器/设备上的数据:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell pm clear {{包名}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 启动模拟器/设备上的一个行为:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell am start -n {{包名}}/{{活动名}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 启动模拟器/设备上的首页活动:
|
2020-11-04 20:12:56 +00:00
|
|
|
|
|
|
|
`adb shell am start -W -c android.intent.category.HOME -a android.intent.action.MAIN`
|