当前位置:   article > 正文

【OpenHarmony】Windows 平台搭建 DevEco Studio 开发环境 ③ ( 华为 Mate30 真机运行鸿蒙应用 | hdc 命令行工具使用 )

【OpenHarmony】Windows 平台搭建 DevEco Studio 开发环境 ③ ( 华为 Mate30 真机运行鸿蒙应用 | hdc 命令行工具使用 )





一、华为 Mate30 真机运行鸿蒙应用




1、连接真机设备


当前的 Mate30 已经升级到了 HarmonyOS 4.0 版本 ;

在这里插入图片描述

在 " 开发人员选项 " 中 , 开启 USB 调试 ;

在这里插入图片描述

连接手机后 , 可以在右上角看到真机设备 ;

在这里插入图片描述

我的手机 使用 " 传输文件 " 的方式 进行 ADB 真机调试 ,

在这里插入图片描述

必须选择 " 只充电 " 方式 ,

在这里插入图片描述

在 开发人员选项 中 , 勾选 " 仅充电模式下允许 ADB 调试 " 选项 ;

在这里插入图片描述


2、配置签名并运行应用


点击 右上角的 运行按钮 , 在真机上运行 应用 ;

在这里插入图片描述

Failure[MSG_ERR_INSTALL_FAILED_NO_BUNDLE_SIGNATURE]

No signature is configured. Configure a signature by referring to the following link.

没有配置签名。请参考以下链接配置签名。

在这里插入图片描述

点击左下角的 Open signing configs 链接 ,

弹出如下对话框 , 等待生成 签名 ;

在这里插入图片描述

生成完毕后的效果如下 , 点击 OK 按钮即可 ;

在这里插入图片描述
然后 , 继续运行 , 应用成功在 真机中运行 ;

在这里插入图片描述





二、hdc 命令行工具使用




1、hdc 工具简介


hdc 工具的 全称是 HarmonyOS Device Connector , 是 用于 在电脑端 调试 HarmonyOS 手机端 的命令行工具 , 通过该工具 , 可以在 电脑端 ( Windows / Linux / Mac ) 中调试 真机 或 虚拟设备 ;

hdc 工具与 Android 调试工具 adb 的作用基本一致 ;

hdc 相关使用文档 : https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/ide-command-line-hdc-0000001237908229-V2


2、配置环境变量


在 HarmonyOS SDK 目录中 的 hmscore\版本号\toolchains 目录下 , 就是相关的 工具链 , D:\001_Develop\053_Huawei\Sdk\hmscore\3.1.0\toolchains ;

hdc 命令行工具 , 就在 toolchains 目录下 ;

在这里插入图片描述

将该目录 配置到 环境变量中 ,

在这里插入图片描述

之后 , 就可以在 命令行中使用 hdc 命令了 ;


3、查看 hdc 帮助信息


执行

hdc help 
  • 1

hdc -h
  • 1

可打印帮助信息 ;

C:\Users\octop>hdc help
[F][2024-05-28 16:16:59] uv_dlsym HdcExtHelp failed The specified procedure could not be found.


                         OpenHarmony device connector(HDC) ...

---------------------------------global commands:----------------------------------
 -h/help [verbose]                     - Print hdc help, 'verbose' for more other cmds
 -v/version                            - Print hdc version
 -t connectkey                         - Use device with given connect key
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

在这里插入图片描述


4、查看 hdc 版本信息


执行

hdc -v
  • 1

hdc version
  • 1

命令 , 可查看 当前 hdc 工具的版本号 ;

C:\Users\octop>hdc -v
Ver: 1.2.0a
  • 1
  • 2

在这里插入图片描述


5、查看设备信息


执行

hdc list targets
  • 1

命令 , 可以查看当前链接的 USB 调试的 HarmonyOS 设备列表 ;

C:\Users\octop>hdc list targets
emulator-5554   device
  • 1
  • 2

在这里插入图片描述

执行

hdc list targets -v
  • 1

命令 , 可以查看当前链接的 USB 调试的 HarmonyOS 设备列表 , 及 详细的设备信息 ;

C:\Users\octop>hdc list targets -v
emulator-5554          device product:JAD-AN00 model:Phone device:HWFCO transport_id:8  external

COM1            UART    Ready           hdc
  • 1
  • 2
  • 3
  • 4

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/647816
推荐阅读
相关标签
  

闽ICP备14008679号