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 权限。
相关推荐
2501_9160088924 分钟前
全面介绍Fiddler、Wireshark、HttpWatch、SmartSniff和firebug抓包工具功能与使用
android·ios·小程序·https·uni-app·iphone·webview
玉梅小洋1 小时前
Windows 10 Android 构建配置指南
android·windows
Libraeking3 小时前
视觉篇:Canvas 自定义绘图与高级动画的华丽圆舞曲
android·经验分享·android jetpack
Fushize3 小时前
多模块架构下的依赖治理:如何避免 Gradle 依赖地狱
android·架构·kotlin
Jomurphys4 小时前
Kotlin - 类型别名 typealias
android·kotlin
Haha_bj4 小时前
Flutter ——flutter_screenutil 屏幕适配
android·ios
Haha_bj4 小时前
Flutter ——device_info_plus详解
android·flutter·ios
前端小伙计4 小时前
Android/Flutter 项目统一构建配置最佳实践
android·flutter
Mr_sun.6 小时前
Day09——入退管理-入住-2
android·java·开发语言
ujainu7 小时前
告别杂乱!Flutter + OpenHarmony 鸿蒙记事本的标签与分类管理(三)
android·flutter·openharmony