Loading...
Loading...
Compare original and translation side by side
adb devices -ldeviceunauthorizedofflineadb kill-server && adb start-serveradb devices -ldeviceunauthorizedofflineadb kill-server && adb start-serveradb pair <ip>:<pairing_port>adb connect <ip>:<connection_port>adb tcpip 5555
adb connect <device_ip>:5555adb pair <ip>:<pairing_port>adb connect <ip>:<connection_port>adb tcpip 5555
adb connect <device_ip>:5555-sadb -s <serial> shell
adb -s emulator-5554 install app.apk-sadb -s <serial> shell
adb -s emulator-5554 install app.apkadb shell # Enter shell
adb shell <command> # Run single command
adb shell "cmd1 && cmd2" # Chain commandsadb shell # 进入Shell环境
adb shell <command> # 执行单个命令
adb shell "cmd1 && cmd2" # 链式执行多个命令undefinedundefinedundefinedundefinedadb shell "logcat -d | head -500"
adb shell "dumpsys activity | head -200"adb shell "logcat -d | head -500"
adb shell "dumpsys activity | head -200"adb install app.apk # Basic install
adb install -r app.apk # Replace existing
adb install -g app.apk # Grant all permissions
adb install -r -g app.apk # Both
adb uninstall com.example.app # Full uninstall
adb uninstall -k com.example.app # Keep dataadb install app.apk # 基础安装
adb install -r app.apk # 覆盖安装现有应用
adb install -g app.apk # 授予应用所有权限
adb install -r -g app.apk # 覆盖安装并授予所有权限
adb uninstall com.example.app # 完全卸载
adb uninstall -k com.example.app # 保留数据卸载undefinedundefinedundefinedundefinedadb shell pm list packages # All packages
adb shell pm list packages -3 # Third-party only
adb shell pm list packages | grep term # Filter
adb shell pm path com.example.app # APK location
adb shell dumpsys package com.example.app # Full package infoadb shell pm list packages # 列出所有应用包
adb shell pm list packages -3 # 仅列出第三方应用包
adb shell pm list packages | grep term # 过滤查找应用包
adb shell pm path com.example.app # 查看APK文件路径
adb shell dumpsys package com.example.app # 查看应用包完整信息adb shell pm grant com.example.app android.permission.CAMERA
adb shell pm revoke com.example.app android.permission.CAMERA
adb shell dumpsys package com.example.app | grep permissionadb shell pm grant com.example.app android.permission.CAMERA
adb shell pm revoke com.example.app android.permission.CAMERA
adb shell dumpsys package com.example.app | grep permissionadb push local_file.txt /sdcard/
adb pull /sdcard/remote_file.txt ./adb push local_file.txt /sdcard/
adb pull /sdcard/remote_file.txt ./undefinedundefinedadb shell run-as com.example.app ls files/
adb shell run-as com.example.app cat shared_prefs/prefs.xml
adb shell run-as com.example.app sqlite3 databases/app.db ".tables"adb shell run-as com.example.app ls files/
adb shell run-as com.example.app cat shared_prefs/prefs.xml
adb shell run-as com.example.app sqlite3 databases/app.db ".tables"undefinedundefinedundefinedundefined| Code | Key | Code | Key |
|---|---|---|---|
| 3 | HOME | 4 | BACK |
| 24 | VOL_UP | 25 | VOL_DOWN |
| 26 | POWER | 66 | ENTER |
| 67 | DEL | 82 | MENU |
| 代码 | 按键 | 代码 | 按键 |
|---|---|---|---|
| 3 | 主页 | 4 | 返回 |
| 24 | 音量加 | 25 | 音量减 |
| 26 | 电源 | 66 | 回车 |
| 67 | 删除 | 82 | 菜单 |
undefinedundefinedundefinedundefinedadb shell uiautomator dump /sdcard/ui.xml
adb pull /sdcard/ui.xmladb shell uiautomator dump /sdcard/ui.xml
adb pull /sdcard/ui.xmlundefinedundefined
**Priority levels:** V(erbose), D(ebug), I(nfo), W(arn), E(rror), F(atal), S(ilent)
**优先级等级:** V(详细)、D(调试)、I(信息)、W(警告)、E(错误)、F(致命)、S(静默)undefinedundefinedundefinedundefinedadb shell dumpsys meminfo com.example.appadb shell dumpsys meminfo com.example.appundefinedundefined
---
---adb shell dumpsys -l # List all servicesadb shell dumpsys -l # 列出所有服务undefinedundefinedadb shell getprop # All properties
adb shell getprop | grep <filter> # Filter propertiesadb shell getprop # 列出所有系统属性
adb shell getprop | grep <filter> # 过滤系统属性undefinedundefinedundefinedundefined
---
---adb reboot # Normal reboot
adb reboot recovery # Recovery mode
adb reboot bootloader # Fastboot mode
adb reboot sideload # Sideload mode
adb reboot-bootloader # Alias for bootloaderadb reboot # 正常重启
adb reboot recovery # 恢复模式
adb reboot bootloader # Fastboot模式
adb reboot sideload # 侧载模式
adb reboot-bootloader # Fastboot模式别名adb kill-server && adb start-server-s <serial>/system/bin/<cmd>adb kill-server && adb start-server-s <serial>/system/bin/<cmd>| Task | Command |
|---|---|
| List devices | |
| Install app | |
| Start app | |
| Stop app | |
| Screenshot | |
| Logs | |
| Shell | |
| Push file | |
| Pull file | |
| Tap | |
| Back | |
| Home | |
references/deep-dive.md| 任务 | 命令 |
|---|---|
| 列出设备 | |
| 安装应用 | |
| 启动应用 | |
| 停止应用 | |
| 截图 | |
| 查看日志 | |
| 进入Shell | |
| 推送文件 | |
| 拉取文件 | |
| 点击屏幕 | |
| 返回键 | |
| 主页键 | |
references/deep-dive.md