当前位置:网站首页>The creation of "harmonyos" project and the use of virtual machines
The creation of "harmonyos" project and the use of virtual machines
2022-07-26 06:40:00 【Starry Luli】
Author's brief introduction : One likes to write , Sophomore rookie of planning major
Personal home page :starry Lu Li
First date :2022 year 7 month 11 Monday, Sunday
Last article :『HarmonyOS』DevEco Download, install and build the development environment
Subscription column :『HarmonyOS』
If the article helps you, remember to praise + Collect and support

『HarmonyOS』 Creation of project and use of virtual machine
1. Create a new project
When developing a HarmonyOS When applied , First, you need to create a wizard according to the project , Create a new project , The tool will automatically generate the corresponding code and resource template .
- Create and configure new projects
First , Open the project creation wizard interface in the following two ways .
- If no project is currently open , Can be in DevEco Studio Welcome page selection Create HarmonyOS Project Start creating a new project .
- If the project has been opened , You can choose... From the menu bar File–>New–>New Project To create a new project .
next , Select the equipment type to be developed according to the project creation wizard , Then choose the corresponding Ability Templates , As shown in the figure below :

single click Next Button , Enter the engineering configuration stage , Basic information of configuration project :
- Project name: The name of the project , You can customize .( Head nomenclature )
- Project type: The type of work , Mark that the project is a Atomic Services (Atomic Service) Or traditional installation application (Application).
- Bundle name: Package name , By default , application / service ID This name will also be used , application / When the service is released , application / service ID Need to be the only . If “Project Type” I chose Atomic Service, be Bundle Name The suffix of must be .hmservice.
- Save location: Local storage path of project files , Please note that , The project storage path cannot contain Chinese characters .
- Development mode: Select the development mode , Some templates support Low code development , Can choose Super Visual.
- Language: The development language supported by the project template , You can choose according to the language supported by the template JS or eTS or Java, among eTS stay DeEco Studio V3.0 Beta2 And above support .
- Compatible API version: Compatible SDK Minimum version .
- Device type: The equipment types supported by this project template , Support multiple choices , Check all by default . If multiple devices are checked , It means that the atomic service or traditional application that needs to be installed supports deployment on multiple devices .
- Show in service center: Whether it is exposed in the service center . If Project type by Atomic Service, A... Will be created synchronously 2 * 2 Service card template , At the same time, an entry card will be created ; If Project type by Application, Will only create one 2*2 Service card template .
- Use ArkCompiler: Turn on the switch , Indicates that the project is compiled and built , Use ArkCompiler The ark compiler compiles .

single click Finish Button , The tool automatically generates sample code and related resources , Wait for the project to be created .

2. Create a local virtual machine
DevEco Studio Provided Local Emulator be based on X86 framework , Can run and debug Phone、TV and Wearable The equipment HarmonyOS application / service . stay Local Emulator Run applications on / Services are compatible with signing and non signing HAP.
Local Emulator Compared with Remote Emulator,Local Emulator yes Create and run on the local computer Of , No login authorization is required , In running and debugging applications / The service , Because there is no exchange of network data , Therefore, it can maintain good fluency and stability ; however It requires a certain amount of computer disk resources .
Create and run Local Emulator Operation steps of
- Click on Files > Settings > SDK Manager > HarmonyOS Legacy SDK Tab , Check and download Platforms Under the System-image and Tools Under the EmulatorX86 resources .
You can see System-image Include phone,tv,wearable, Corresponding to mobile phones respectively , TV and wearable devices ; I c Only download if the disk is limited phone resources , Demonstrate local phone virtual machine


choice Phone, Then click Install request component library

installation is complete

stay Local Emulator In the TAB. , Click on the New Emulator Button , Create a local simulator . By default , The created local simulator resources will be stored in C:\Users\ user name \AppData\Local\Huawei\HarmonyOSEmulator\deployed Under the table of contents , It will occupy a large system storage space .

In the create simulator interface , You can choose a default device ; You can also click New Hardware Or the clone icon behind the default device , Add a new device , In order to customize the relevant parameters of the device , As size 、 The resolution of the 、 Memory and other parameters . Customize new devices , Currently only supported Phone equipment ,TV and Wearable Temporary does not support . establish New Hardware when , You can modify the name of the device 、 Size 、 The resolution of the 、 Memory and other parameters .

Click on Next, Verify and determine the simulator information that needs to be created , At the same time, you can also modify the simulator information in this interface , And then click Finish Create a local Simulator .


3. Use remote virtual machines ( recommend )
Remote Emulator Support Wearable、Tablet、TV And so on , But different areas ( Where the developer account is registered ) The supported device types may be different , Please refer to the type of equipment that can be applied for .
3.1 Single terminal
Remote Emulator The single device simulator in can run and debug Phone( Folding screen Mate X2、P40 and P40 Pro)、Tablet(MatePad Pro)、TV and Wearable The equipment HarmonyOS application / service , Compatible with signature and non signature HAP.
Remote Emulator The duration of each use is 1 Hours , Resources will be released automatically after expiration , Please complete it in time HarmonyOS application / Service debugging . If Remote Emulator After expiration and release , You can reapply for resources ( Login again ).
The specific steps are as follows :
- stay DevEco Studio menu bar , Click on Tools > Device Manager.
- stay Remote Emulator In the TAB. , Click on Login, The login interface of Huawei developer alliance account pops up in the browser , Please enter the user name and password of the Huawei developer alliance account with real name authentication to log in ( Check the remote emulator login FAQ ).
- After logging in , Please click the allow button on the interface to authorize , After successful authorization DevEco Studio The confirm authorization window will appear , Click on Agree that will do .
After login, you can see DevEco Created for us 6 Virtual machines , stay Single device in , Click the device operation button , Start the remote simulation device ( Only one device can be started at a time ).

Then you can experience it for free for an hour P40, Hee hee , Lightly brush Tiktok , Although it's a little stuck .

3.2 hyper terminal
At present, HyperTerminal simulator supports “Phone+Phone”、“Phone+Tablet” and “Phone+TV” Device networking mode , Developers can use the HyperTerminal simulator to test applications with cross device characteristics / service , Such as application / The circulation of services between different devices .

The specific steps are as follows :
stay DevEco Studio menu bar , Click on Tools > Device Manager.
stay Remote Emulator In the TAB. , Click on Login. The login interface of Huawei developer alliance account pops up in the browser , Please enter the user name and password of the Huawei developer alliance account with real name authentication to log in . If you are already logged in , You can jump directly to the 4) Step .
After logging in , Please click the allow button on the interface to authorize .
stay Super device in , Click the device operation button , Start the HyperTerminal simulator .
Running applications / In service , choice Super App, And then click Run > Run’ Module name ’ or , Or use the default shortcut Shift+F10(macOS by Control+R) Run the application / service

Operation can start two devices at the same time , Double happiness, okay

边栏推荐
猜你喜欢

Decomposing a positive integer into prime factors requires decomposing into as many factors as possible.

『HarmonyOS』探索HarmonyOS应用

IP day 10 notes - BGP

UIToolkit工具模板工程

原生高性能抓包工具Proxyman,送给爱学习的你

Heap sort

How to solve the crash when the easygbs platform edits the device management group?
![[Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you](/img/57/f263f3f3c40b1440b0cbb58c5e05a5.jpg)
[Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you
![[C language] file operation](/img/19/5bfcbc0dc63d68f10155e16d99581c.png)
[C language] file operation

『HarmonyOS』工程的创建与虚拟机的使用
随机推荐
C# 可以利用反射给只读属性赋值吗?
@Constructorproperties annotation understanding and its corresponding usage
A tool for quickly switching local host files -- switchhosts
CONDA virtual environment envs directory is empty
Esxi 7.0 installation supports mellanox technologies mt26448 [connectx en 10gige, PCIe 2.0 5gt/s] driver, and supports the cheapest 10GB dual fiber network card
"Harmonyos" explore harmonyos applications
BigDecimal变为负数
Code runner for vs code, with more than 40million downloads! Support more than 50 languages
Gdown Access denied:Cannot retrieve the public link of the file.
@ConstructorProperties注解理解以及其对应使用方式
Do it yourself smart home: intelligent air conditioning control
[day_070425] Fibonacci series
Map dictionary and constraints of go
深度学习——CV、CNN、RNN
[1]数学建模基础入门知识
nuxt 配置主题切换
输入5个学生的记录(每条记录包括学号和成绩), 组成记录数组, 然后按照成绩由高到低的次序输出. 排序方法采用选择排序
MySQL基础篇(二)-- MySQL 基础
Map collection inheritance structure
How does the seckill system ensure that the database does not crash and prevent oversold goods