| 查看已连接设备 |
adb devices |
Libimobiledevice:idevice_id -lxcrun:xcrun simctl list devices(模拟器) |
hdc list targets |
| 设备基础信息查询 |
adb shell getprop ro.product.model(型号)adb shell getprop ro.build.version.release(系统版本) |
Libimobiledevice:ideviceinfo(全量信息)xcrun:xcrun simctl info <设备UDID>(模拟器) |
hdc shell param get persist.sys.product.model(型号)hdc shell getprop hw_sc.build.os.version(系统版本) |
| 安装应用 |
adb install <APK路径> |
Libimobiledevice:ideviceinstaller -i <IPA路径>xcrun:xcrun simctl install <设备UDID> <APP路径>(模拟器) |
hdc install <HAP/HSP路径> |
| 卸载应用 |
adb uninstall <应用包名> |
Libimobiledevice:ideviceinstaller -U <应用Bundle ID>xcrun:xcrun simctl uninstall <设备UDID> <Bundle ID>(模拟器) |
hdc uninstall <应用包名> |
| 进入设备 Shell 终端 |
adb shell |
Libimobiledevice:ideviceshellxcrun:xcrun simctl spawn <设备UDID> bash(模拟器) |
hdc shell |
| 推送文件到设备 |
adb push <本地文件路径> <设备目标路径> |
Libimobiledevice:ideviceinstaller -p <本地文件> -o copy=<设备路径>(或ifuse挂载后拷贝)xcrun:xcrun simctl addmedia <设备UDID> <文件路径>(媒体文件) |
hdc file send <本地文件路径> <设备目标路径> |
| 从设备拉取文件 |
adb pull <设备文件路径> <本地目标路径> |
Libimobiledevice:ideviceinstaller -u <设备文件> -o copy=<本地路径>(或ifuse挂载后拷贝)xcrun:xcrun simctl get_app_container <设备UDID> <Bundle ID>(获取 APP 目录后拷贝) |
hdc file recv <设备文件路径> <本地目标路径> |
| 重启设备 |
adb reboot |
Libimobiledevice:无直接命令(需物理操作 / 开发者模式脚本)xcrun:xcrun simctl shutdown <设备UDID>+xcrun simctl boot <设备UDID>(模拟器) |
hdc shell reboot |
| 查看系统日志 |
adb logcat |
Libimobiledevice:idevicesyslogxcrun:xcrun simctl spawn <设备UDID> log stream(模拟器) |
hdc shell hilog |
| 截图 |
adb exec-out screencap -p > <本地路径>.png |
Libimobiledevice:idevicescreenshot <本地路径>.pngxcrun:xcrun simctl io <设备UDID> screenshot <本地路径>.png(模拟器) |
hdc shell screencap -p <设备路径>.png(需配合 pull 拉取) |
| 录屏 |
adb shell screenrecord <设备路径>.mp4 |
Libimobiledevice:无原生命令(需第三方工具)xcrun:xcrun simctl io <设备UDID> recordVideo <本地路径>.mp4(模拟器) |
hdc screenrecord <本地路径>.mp4 |
| 查看进程信息 |
adb shell ps |
Libimobiledevice:ideviceshell psxcrun:xcrun simctl spawn <设备UDID> ps(模拟器) |
hdc shell ps |
| 查看 CPU 使用率 |
adb shell top |
Libimobiledevice:ideviceshell topxcrun:xcrun simctl spawn <设备UDID> top(模拟器) |
hdc shell top |
| 端口转发 |
adb forward tcp:<本地端口> tcp:<设备端口> |
Libimobiledevice:iproxy <本地端口> <设备端口> <设备UDID>xcrun:无(模拟器共享主机网络) |
hdc fport tcp:<本地端口> tcp:<设备端口> |