Android (ADB)、iOS、OpenHarmony 常用调试命令对照表

功能场景 Android (ADB 命令) iOS(Libimobiledevice/xcrun) OpenHarmony (HDC 命令)
查看已连接设备 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:<设备端口>

补充说明:

  1. iOS 命令差异
    • Libimobiledevice 是跨平台 iOS 调试工具,无需 Xcode;xcrun 依赖 Xcode,主要用于模拟器 / 开发机调试;
    • iOS 封闭性较强,部分操作(如系统文件访问)需越狱或特殊权限,命令功能受限。
  2. OpenHarmony 命令说明
    • HDC(HarmonyOS Device Connector)是 OpenHarmony 官方调试工具,语法与 ADB 高度相似,学习成本低;
    • 部分命令参数与 ADB 一致(如shell/install/uninstall),可直接类比使用。
  3. 通用注意事项
    • 所有平台调试前需开启对应调试模式(Android:USB 调试;iOS:开发者模式;OpenHarmony:调试模式);
    • 命令路径需根据实际环境调整,部分命令需管理员 /root 权限。
相关推荐
Railshiqian2 小时前
DeepSeek反馈的,如何通过adb获取某个Window或View的绘制内容的方法
android·adb
消失的旧时光-19432 小时前
Android(Kotlin) ↔ Flutter(Dart) 的“1:1 对应表”:架构分层来对照(MVVM/MVI 都适用)
android·flutter·kotlin
Coffeeee2 小时前
Android15适配之edge-to-edge和16kb到底咋适配
android·前端·android studio
sweet丶2 小时前
CocoaPods Podfile优化设置手册-持续更新
ios·架构
Java猿_11 小时前
Spring Boot 集成 Sa-Token 实现登录认证与 RBAC 权限控制(实战)
android·spring boot·后端
Jerry13 小时前
Jetpack Compose Navigation
android
介一安全14 小时前
【Frida Android】实战篇17:Frida检测与绕过——基于inline hook的攻防实战
android·网络安全·逆向·安全性测试·frida
龙之叶15 小时前
Android如何通过adb命令push文件后在媒体库中显示
android·adb
Just_Paranoid16 小时前
【Settings】Android 设备信息相关参数的获取
android·5g·wifi·ip·sn·network