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.rhkb.cn/news/228627.html

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

相关文章

2024年人工智能领域10大预测

2023年人工智能领域如果只能筛选一个关键词的话,恐怕非“大模型”莫属。大模型的发展在过去一年中,让各行各业发生了天翻地覆的变化,有企业因大模型而新生,有企业因大模型而消亡。企业的变迁跟技术迭代息息相关,而大模…

C# MVC +Layui侧边导航栏的收缩及展开

目录 1、头部代码 2、侧边栏&#xff08;例子只写了一级导航&#xff0c;需要多级可自行添加&#xff09; 3、body内容填充 4、 JS 1、头部代码 <div class"layui-layout layui-layout-admin"> <div class"layui-header"> …

27 UVM queue

uvm_queue类构建一个动态队列&#xff0c;该队列将按需分配并通过引用传递。 uvm_queue类声明&#xff1a; class uvm_queue #( type T int ) extends uvm_object 1 uvm_queue class hierarchy 2 uvm_queue class Methods 3 UVM Queue Example 在下面的示例中&#xff0c;…

MySQL 数值函数,字符串函数与多表查询

MySQL像其他语言一样,也提供了很多库函数,分为单行函数和分组函数(聚合函数),我们这里先简易介绍一些函数,熟悉就行,知道怎么使用即可. 数值函数 三角函数 指数与对数函数 进制间的转换函数 字符串函数 注:LPAD函数是右对齐,RPAD函数是左对齐 多表查询 注:如果为表起了别名,就…

easyx的窗口函数

文章目录 前言一、EasyX的颜色二、EasyX的坐标和设备1&#xff0c;EasyX的坐标2&#xff0c;EasyX的设备 三、窗口函数1&#xff0c;初始化窗口函数2&#xff0c;关闭绘图窗口3&#xff0c;设置窗口背景板颜色4&#xff0c;清空绘图设备 前言 easyx是针对c的图形库&#xff0c;…

[ffmpeg系列 02] 音视频基本知识

一 视频 RGB&#xff1a; AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB… Y&#xff1a;明亮度, Luminance或luma, 灰阶图&#xff0c; UV&#xff1a;色度&#xff0c;Chrominance或Chroma。 YCbCr: Cb蓝色分量&#xff0c;Cr是红色分量。 取值范围&#xff…

判断电话号码是否重复-excel

有时候重复的数据不需要或者很烦人&#xff0c;就需要采取措施&#xff0c;希望以下的方法能帮到你。 1.判断是否重复 方法一&#xff1a; 1&#xff09;针对第一个单元格输入等号&#xff0c;以及公式countif(查找记录数的范围&#xff0c;需要查找的单元格&#xff09; 2…

网络编程『简易TCP网络程序』

&#x1f52d;个人主页&#xff1a; 北 海 &#x1f6dc;所属专栏&#xff1a; Linux学习之旅、神奇的网络世界 &#x1f4bb;操作环境&#xff1a; CentOS 7.6 阿里云远程服务器 文章目录 &#x1f324;️前言&#x1f326;️正文TCP网络程序1.字符串回响1.1.核心功能1.2.程序…

AIGC开发:调用openai的API接口实现简单机器人

简介 开始进行最简单的使用&#xff1a;通过API调用openai的模型能力 OpenAI的能力如下图&#xff1a; 文本生成模型 OpenAI 的文本生成模型&#xff08;通常称为生成式预训练 Transformer 或大型语言模型&#xff09;经过训练可以理解自然语言、代码和图像。这些模型提供文…

logstash收集华为、H3C、Cisco交换机日志

网络设备配置 将 syslog-ip 替换成服务器的IP地址。 Huawei info-center loghost source interface info-center loghost syslog-ip local-time facility local6 H3C info-center loghost source interface info-center loghost syslog-ip facility local5 Aruba logging arm …

上市公司企业战略激进度2004-2022市场扩张创新倾向成长性生产效率组织结构稳定性资本密度防御分析进攻型

上市公司企业战略激进度2004-2022市场扩张创新倾向成长性生产效率组织结构稳定性资本密度防御分析进攻型有原始数据、详细代码、计算结果&#xff01;数据来源&#xff1a;基于上市公司公告数据整理计算 数据范围&#xff1a;沪深北证A股上市公司【2023新数据】上市公司企业战略…

linux cat命令增加-f显示文件名功能

在使用cat命令配合grep批量搜索文件内容时&#xff0c;我仅仅能知道是否搜索到&#xff0c;不知道是在哪个文件里找到的。比如cat ./src/*.c | grep full_write,在src目录下的所有.c文件里找full_write,能匹配到所有的full_write&#xff0c;但是不知道它们分别在哪些文件里。于…

「微服务」微服务架构中的数据一致性

在微服务中&#xff0c;一个逻辑上原子操作可以经常跨越多个微服务。即使是单片系统也可能使用多个数据库或消息传递解决方案。使用多个独立的数据存储解决方案&#xff0c;如果其中一个分布式流程参与者出现故障&#xff0c;我们就会面临数据不一致的风险 - 例如在未下订单的情…

进程互斥的软件实现方法-第二十六天

目录 前言 单标志法&#xff08;谦让&#xff09; 双标志先检查法&#xff08;表达意愿&#xff09; 双标志后检查法&#xff08;表达意愿&#xff09; Peterson算法&#xff08;集大成者&#xff09; 本节思维导图 前言 单标志法、双标志的先后检查法中&#xff0c;如果…

【Java】SpringBoot快速整合WebSocket实现客户端服务端相互推送信息

目录 什么是webSocket&#xff1f; webSocket可以用来做什么? WebSocket操作类 一&#xff1a;测试客户端向服务端推送消息 1.启动SpringBoot项目 2.打开网站 3.进行测试消息推送 4.后端进行查看测试结果 二&#xff1a;测试服务端向客户端推送消息 1.接口代码 2.使…

48、激活函数 - 梯度消失和梯度爆炸

简单介绍下梯度消失和梯度爆炸,这个不是重点,但是我觉得有必要再深入了解这个概念,以及很多激活函数为什么是可以防止梯度消失的。 梯度消失和梯度爆炸实际上是在神经网络训练过程中经常会遇到的两类问题,这两类问题都与梯度有关。 什么是梯度 在神经网络训练中,梯度是指…

ALSA学习(5)——设备中的alsa

参考博客&#xff1a; https://blog.csdn.net/DroidPhone/article/details/7165482 &#xff08;一下内容基本是原博主的博客转载&#xff09; 文章目录 一、ASOC的由来二、硬件架构三、软件架构四、数据结构五、内核对ASoC的改进 一、ASOC的由来 ASoC–ALSA System on Chip …

08-接口文档管理工具-项目集成knife4j__ev

2、knife4j快速入门 2.1 knife4j介绍 knife4j是为Java MVC框架集成Swagger生成Api文档的增强解决方案,前身是swagger-bootstrap-ui,取名kni4j是希望它能像一把匕首一样小巧,轻量,并且功能强悍! gitee地址&#xff1a;knife4j: Knife4j是一个集Swagger2 和 OpenAPI3为一体的增…

基于图神经网络的动态物化视图管理

本期 Paper Reading 主要介绍了发布于 2023 年 ICDE 的论文《Dynamic Materialized View Management using Graph Neural Network》&#xff0c;该文研究了动态物化视图管理问题&#xff0c;提出了一个基于 GNN 的模型。在真实的数据集上的实验结果表明&#xff0c;取得了更高的…

SPI通信

SPI通信 1、SPI通信概述 SPI(Serial peripheral interface)是一种同步、串行、全双工、总线制、主从工作方式。 有四线控制&#xff1a; SDO——主设备数据输出&#xff0c;从设备数据输入&#xff0c;对于MOSI output slave inputSDI——主设备数据输入&#xff0c;从事设备…