HarmonyOS应用开发-搭建开发环境

本文介绍如何搭建 HarmonyOS 应用的开发环境,介绍下载安装 DevEco Studio 开发工具和 SDK 的详细流程。华为鸿蒙 DevEco Studio 是面向全场景的一站式集成开发环境,面向全场景多设备,提供一站式的分布式应用开发平台,支持分布式多端开发、分布式多端调测、多端模拟仿真,提供全方位的质量与安全保障。

一、下载安装 DevEco Studio

1、官网下载 DevEco Studio

官网:HUAWEI DevEco Studio和SDK下载和升级 | HarmonyOS开发者
下载 DevEco Studio 3.1.1 Release 最新版本。

1 001 1024x429 - Harmony应用开发-搭建开发环境

下载完成后我们解压压缩包,点击启动exe安装程序。


2、安装 DevEco Studio

启动安装exe程序,点击Next下一步。

1 002 - Harmony应用开发-搭建开发环境

选择安装路径,这里根据大家自己的喜好选择路径安装即可,需要2GB的存储空间。

1 003 - Harmony应用开发-搭建开发环境

下一步,我们勾选 “生成快捷方式” 和 “添加到path环境变量” 。

1 004 - Harmony应用开发-搭建开发环境

这里默认文件夹名,点击安装。

1 005 - Harmony应用开发-搭建开发环境

完成安装,需要对电脑重启。

1 006 - Harmony应用开发-搭建开发环境


二、运行 DevEco Studio

1、安装 Node.js 和 ohpm

首次运行 DevEco Studio 会来到这个页面。
HarmonyOS应用开发需要我们的电脑上安装 Node.js 和 ohpm (鸿蒙生态三方库的包管理工具)
这里华为官方提供了镜像,如果本机上之前没有装过,直接勾选 install 然后下一步即可。

1 007 - Harmony应用开发-搭建开发环境


2、安装HarmonyOS SDK

这里选择安装路径即可,我直接默认路径,点击下一步。

1 008 - Harmony应用开发-搭建开发环境

这个页面展示了所有需要安装的包,点击下一步安装。

1 009 - Harmony应用开发-搭建开发环境

几分钟后安装完成。

1 010 - Harmony应用开发-搭建开发环境


三、新建项目

新建一个Empty Ability。

1 011 1024x613 - Harmony应用开发-搭建开发环境

默认Stage模式,开启Super Visual低代码模式。

1 012 - Harmony应用开发-搭建开发环境


 四、运行项目

1、创建测试页面

这里我通过低代码组件随便做了一个登录页。我们低代码组件的改动体现在index.visual上。

1 013 1024x691 - Harmony应用开发-搭建开发环境

index.visual代码我提供出来给大家参考:

{"document": {"VisualVersion": "12","type": "ETS","custom": false,"path": "/entry/src/main/supervisual/pages/Index"},"visualModel": {"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"width": "100%","height": "100%"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"width": "100%","height": "100%","justify-content-rc": "center","position": "absolute","top": "0vp","left": "0vp","border-bottom-color": "#4a4a4a","border-bottom-width": "1vp"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"position": "absolute","top": "95vp","width": "100%","height": "100vp","display-priority": "0","align-items-row": "center","justify-content-rc": "center"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"width": "100vp","height": "100vp","align": "center","top": "0vp","background-image-size": "auto","position": "relative","src": "$r('app.media.icon')","left": "0%"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "image1","type": "image"}}],"id": "row3","type": "row"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "50vp","width": "100%","left": "0vp","top": "200vp","border-top-right-radius": "0vp","content": "登录界面","font-size": "26fp","font-weight": "medium","font-family": "sans-serif","text-align": "center","text-overflow": "clip","position": "absolute"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text1","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "30vp","width": "100%","left": "0vp","top": "250vp","content": "登录帐号以使用更多服务","font-size": "14fp","text-align": "center","font-color": "#8c8c8c","position": "absolute"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text2","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "50vp","width": "100%","left": "0vp","top": "328vp","position": "absolute","placeholder": "邮箱/手机号/用户名","margin-bottom": "0vp","padding-top": "0vp","border-bottom-width": "1vp","border-bottom-color": "#4a4a4a","background-color": "#ffffff"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text-input1","type": "text-input"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "50vp","width": "100%","left": "0vp","top": "380vp","position": "absolute","placeholder": "密码","textInput-type": "Password","background-color": "#ffffff","border-bottom-width": "1vp","border-bottom-color": "#4a4a4a"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text-input2","type": "text-input"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"position": "absolute","top": "430vp","left": "5%","width": "90%","height": "30vp"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "30vp","width": "50%","position": "absolute","top": "0px","left": "50%","text-align": "end","content": "忘记密码","font-size": "14fp"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text3","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "30vp","width": "50%","text-align": "start","position": "absolute","content": "短信验证码登录","font-size": "14fp","top": "0vp","left": "0%"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text4","type": "text"}}],"id": "row1","type": "row"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"position": "absolute","top": "92%","left": "5%","height": "8%","width": "90%"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "100%","width": "33.3%","position": "absolute"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text7","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "100%","width": "33.4%","position": "absolute"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text9","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "100%","width": "33.3%","text-align": "end","position": "absolute"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text8","type": "text"}}],"id": "row2","type": "row"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"width": "90%","height": "40vp","label": "登录","font-size": "20fp","position": "absolute","top": "530vp","left": "5%"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "button1","type": "button"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "30vp","width": "100%","content": "注册账号","text-align": "center","font-size": "14fp","position": "absolute","top": "570vp","left": "0vp"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text5","type": "text"}},{"dataType": "VisualModel","value": {"propertyStorage": {"dataType": "Map","value": {}},"dynamicPropertyStorage": {"dataType": "Map","value": {}},"mediaPropertyStorage": {"dataType": "Map","value": {}},"dynamicMediaPropertyStorage": {"dataType": "Map","value": {}},"property": {"dataType": "Map","value": {"height": "4%","width": "100%","text-align": "center","font-size": "14fp","position": "absolute","top": "88%","left": "0vp","content": "其他方式登录","align": "center"}},"dynamicProperty": {"dataType": "Map","value": {}},"children": [],"id": "text6","type": "text"}}],"id": "column1","type": "column"}}],"id": "wrapper","type": "column"}},"formData": {"data": {"dataType": "Map","value": {}},"actions": {"dataType": "Map","value": {}}},"customData": {"property": {"dataType": "Map","value": {}},"event": {"dataType": "Map","value": {}}}
}

我们点击运行按钮,会让我们选择运行设备,这里的设备都是模拟器,需要安装,我们先进入设备管理器安装设备。

1 014 1024x691 - Harmony应用开发-搭建开发环境


2、安装设备仿真器

这个模板支持手机、电视、手表三种终端模拟,我们先安装emulator(仿真器)。

1 015 1024x635 - Harmony应用开发-搭建开发环境

1 016 1024x694 - Harmony应用开发-搭建开发环境

安装好之后,我们再点击每一个硬件设备单独安装。这里我选择的手机。

1 017 1024x646 - Harmony应用开发-搭建开发环境

我选择的API9版本。

1 018 1024x647 - Harmony应用开发-搭建开发环境

要安装个几分钟。

1 019 - Harmony应用开发-搭建开发环境

安装完成。

1 020 1024x648 - Harmony应用开发-搭建开发环境


3、开启设备仿真器

点击我们刚刚新建的设备,启动它。

1 021 1024x637 - Harmony应用开发-搭建开发环境

仿真终端被立刻启动。

1 022 1024x687 - Harmony应用开发-搭建开发环境

完全启动大概需要个一分钟,开机后如下:

1 023 1024x687 - Harmony应用开发-搭建开发环境


4、运行项目

我们运行项目。

1 024 1024x687 - Harmony应用开发-搭建开发环境

我们制作的应用会在仿真设备里打开。

1 025 1024x587 - Harmony应用开发-搭建开发环境

测试我们登录界面是否可以正常输入和点击。

1 026 1024x608 - Harmony应用开发-搭建开发环境

测试没有问题,标志着我们新建的HarmonyOS应用运行成功。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/313852.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【SpringCloud Alibaba笔记】(2)Nacos服务注册与配置中心

Nacos Nacos简介与下载 是什么? 一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。 Nacos(Dynamic Naming and Configuration Service)就是注册中心+配置中心的组合 Nacos Eureka Config Bus 替代Eureka…

金蝶云星空反写规则表结构同步另一个数据库

文章目录 金蝶云星空反写规则表结构同步另一个数据库在BOS找到《反写规则》的表反写规则相关表创建反写规则,或者已经创建好的反写规则定位反写规则数据导出表数据执行脚本BOS导入数据库直接执行 金蝶云星空反写规则表结构同步另一个数据库 在BOS找到《反写规则》的…

未来的智能:人机环境系统智能

2023年即将过去,2024年即将到来,未来会是怎样的呢?未来的智能又会是怎样的呢?针对这个问题我们不妨展开想象的翅膀憧憬一下,或许可以在不经意中碰上不远后的脚步! 随着科技的发展和人工智能的不断进步&…

大数据规模存储的几个核心问题

文章目录 三个关键问题RAID(独立磁盘冗余阵列)RAID是如何解决关于存储的三个关键问题?水平伸缩 大规模数据存储都需要解决几个核心问题,这些问题都是什么呢? 三个关键问题 1.数据存储容量的问题 既然大数据要解决的…

es简单入门

星光下的赶路人star的个人主页 努力努力再努力 文章目录 1、简介2、使用场景3、基本知识4、中文文档和官网链接5、增删改查(php代码)6、基本查询7、HTTP操作7.1 索引操作7.1.1 创建索引 7.2 文档操作7.2.1 创建文档7.2.2 查看文档7.2.3 修改文档7.2.4 修…

计算机操作系统(OS)——P5设备管理

1、I/O设备的概念和分类 什么是I/O设备 I/O就是输入/输出(Input/Output)。 I/O设备就是可以将数据输入到计算机,或者可以接收计算机输出数据的外部设备,属于计算机中的硬件部件。 UNIX系统将外部设备抽象为一种特殊的文件&#x…

数据结构--队列【详解】~(˶‾᷄ꈊ‾᷅˵)~

目录 队列定义: 队列的声明与头文件的包含: 队列的声明: 头文件的包含: 队列的基本操作: 初始化队列 : 摧毁队列: 入队列: 出队列: 返回队头数据: 返回队尾数据&#xff1…

区分LR(0),SLR(1),LR(1)和LALR(1)

目录 对于LR(0)文法: 对于SLR(1)文法: 对于LR(0)和SLR(1)文法: 对于LR(1)和SLR(1)文法: 对于LALR(1)文法: 例题1: 例题2: 例题3: 例题4: 这几个文法大致的步骤都…

适用于各种危险区域的火焰识别摄像机,实时监测、火灾预防、安全监控,为安全保驾护航

火灾是一种极具破坏力的灾难,对人们的生命和财产造成了严重的威胁。为了更好地预防和防范火灾,火焰识别摄像机作为一种先进的监控设备,正逐渐受到人们的重视和应用。本文将介绍火焰识别摄像机在安全监控和火灾预防方面的全面应用方案。 一、火…

29 UVM Command Line Processor (CLP)

随着设计和验证环境的复杂性增加,编译时间也增加了,这也影响了验证时间。因此,需要对其进行优化,以便在不强制重新编译的情况下考虑新的配置或参数。我们已经看到了function or task如何基于传递参数进行行为。类似地,…

2023结婚成家,2024借势起飞

您好,我是码农飞哥(wei158556),感谢您阅读本文,欢迎一键三连哦。 💪🏻 1. Python基础专栏,基础知识一网打尽,9.9元买不了吃亏,买不了上当。 Python从入门到精…

【Redis-05】Redis如何实现保存键值对的保存及过期键的管理策略

在之前的文章我们介绍过,Redis服务器在启动之初,会初始化RedisServer的实例,在这个实例中存在很多重要的属性结构,同理本篇博客中介绍的数据库实现原理也会和其中的某些属性相关,我们继续看一下吧。 1.服务器和客户端…