HarmonyOS first experience: create your first Hongmeng application


Preface

1. HarmonyOS system definition

HarmonyOS is a "future-oriented" distributed operating system for all scenarios (mobile office, sports health, social communication, media entertainment, etc.). Based on the traditional single-device system capability, HarmonyOS proposes a distributed concept based on the same set of system capabilities and adapting to multiple terminal forms, which can support multiple terminal devices.

  • For consumers, HarmonyOS can integrate the capabilities of various terminals in the life scene, enabling fast connection, mutual assistance, and resource sharing between different terminal devices, matching appropriate devices, and providing a smooth full-scene experience.

  • For application developers, HarmonyOS uses a variety of distributed technologies, making application development and implementation independent of the differences in the form of different terminal devices. This allows developers to focus on the upper-level business logic and develop applications more conveniently and efficiently.

    For device developers, HarmonyOS adopts a componentized design scheme, which can be flexibly tailored according to the resource capabilities and business characteristics of the device to meet the requirements of different types of terminal devices for the operating system.

HarmonyOS code development supports multiple languages, including Java, XML (Extensible Markup Language), C/C++, JS (JavaScript), CSS (Cascading Style Sheets) and HML (HarmonyOS Markup Language)


Tip: The above content is excerpted from the official website of Hongmeng OS developer

2. Create the first Hongmeng application

Before starting, please refer to Hongmeng Developer’s official website to download and install software and configure development environment to complete the installation of development tools and configuration of development environment .
Tip: This article takes JS SDK as an example.

1. New Hongmeng Project

Open DevEco Studio and select Create HarmonyOS Project:
Insert picture description here

2. Select equipment and template

Here, Device selects the first TV , because JS SDK is used for development, so select Empty Feature Ability(JS) under Template , and then click Next in the lower right corner .

Insert picture description here

3. Perform project configuration

Fill in the project name, package name, save address and SDK version in turn (the default is fine), and click Finish in the lower right corner .

Insert picture description here

4. Project compilation

After creating the project, DevEco Studio will synchronize the project. To create a project for the first time, you need to download Gradle-related dependencies, which takes a long time and requires patience. The project directory structure is as follows:

Insert picture description here
Then we run the project, click Tools > HVD Manager in the DevEco Studio menu bar . When using the simulator for the first time, you need to download the relevant resources of the simulator. After the resource download is complete, click the Refresh button in the lower left corner of the simulator interface .
Insert picture description here
Because I have already downloaded it, I directly enter the HUAWEI account login interface that pops up in the browser, enter the HUAWEI developer account and password that have been verified by real name, and then log in, and then click the allow button in the lower right corner of the authorization interface .

Insert picture description here
Select TV in the device list and click the triangle run button on the right to start the TV simulator in the cloud.
Insert picture description here
After the startup is complete, as shown below:

Insert picture description here
Click the green triangle button on the right side of DevEco Studio to run the project (default shortcut Shift + F10 ), and the successful run page is shown in the figure below: The
Insert picture description here
simulator will last for 1 hour each time, and the simulator will automatically release resources after expiration. It needs to be timely Complete debugging of HarmonyOS application. If the simulator expires and is released, you need to reapply for simulator resources.

to sum up

The above is the content of today. This article only briefly introduces HarmonyOS application development. For detailed introduction, please visit the official website of HarmonyOS application developer .

Guess you like

Origin blog.csdn.net/tseng711/article/details/109132731