hdc(HarmonyOS Device
Connector)是HarmonyOS为开发人员提供的用于调试的命令行工具,通过该工具可以在window/linux/mac系统上与真实设备或者模拟器进行交互。
(1)
hdc list targets
(2)
hdc file send local remote
(3)
hdc install package File
这里列举的几个命令是不是很熟悉?一看名字就知道和安卓中的adb是对应关系。不需要去记忆,在需要使用到的时候去官网查一下就行: hdc使用指导
2、Mac系统配置hdc 环境变量

3、项目中的配置文件
安卓中最主要的配置文件是AndroidManifest.xml。 其中定义了版本号,申明了页面路径,注册了广播和服务。并且申明了App使用的权限。
而鸿蒙中也对应有配置文件,但与安卓稍有不同的是鸿蒙分为多个文件。
(1) build-profile.json5
Sdk Version配置在这里, 代码的模块区分也在这里:
{
"app": {
"signingConfigs": [],
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default",
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
(2)app.json5
包名,VersionCode,VersionName等信息
{
"app": {
"bundleName": "com.example.firstDemo",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
(3)module.json5
模块的详细配置,页面名称和模块使用到的权限在这里申明
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"requestPermissions":[
{
"name" : "ohos.permission.APPROXIMATELY_LOCATION",
"reason": "$string:reason",
"usedScene": {
"abilities": [
"FormAbility"
],
"when":"inuse"
}
}
]
}
}
4、对应安卓的权限管理
鸿蒙有ATM,ATM(AccessTokenManager)是HarmonyOS上基于AccesssToken构建的统一的应用权限管理能力
5、对应安卓的SharedPreferences能力,鸿蒙有首选项能力

审核编辑 黄宇
-
hdc
+关注
关注
1文章
49浏览量
4052 -
鸿蒙
+关注
关注
60文章
3016浏览量
46163 -
HarmonyOS
+关注
关注
80文章
2157浏览量
36279
发布评论请先 登录
示波器小知识点
【黑金云课堂笔记】第一~二期知识点总结
【黑金云课堂笔记】第三期知识点总结
鸿蒙智能体开发知识库---创建知识库
模拟电路入门的知识点
声智科技携手华为鸿蒙推动声学AI技术革新
开源鸿蒙城市技术沙龙武汉站圆满落幕
【项目实战】基于WS63的鸿蒙星闪红外遥控车(循迹、超声波避障、远程控制、星闪/红外遥控)有教程代码
鸿蒙知识点
评论