Hello, everyone, I am a code worker, a code farmer with ten years of working experience, devoted to the pursuit of technology.

Introduction to the

Huawei HongMeng system (English: huaweiHarmonyOS, HongmengOS). On August 9, 2019, Huawei held the Huawei Developer Conference in Dongguan, and officially launched the operating system Hongmeng OS, which is version 1.0.

Hongmeng OS is a “future-oriented” operating system, a distributed operating system based on micro kernel and oriented to full scenes. It has been adapted to smart screen, and in the future it will be adapted to mobile phones, tablets, computers, smart cars, wearable devices and other multi-terminal devices.

On September 10, 2020, Huawei Hongmeng System was upgraded to Huawei Hongmeng System 2.0.

Yu said a beta version of Hongmeng 2.0 will be available to developers in December 2020

Although hongmeng OS 1.0 was released in August 2019, no development documentation was released, and those interested in it had no idea what to do, just the concept. After that, Hongmeng OS was regarded as a hoax for a long time. On September 10, 2020, this phenomenon was changed.

Hongmeng OS code officially open, corresponding to also open the relevant documents, development tools and so on, with these developers can be demo development.

Open source data

As a developer, I am very interested in this, read about the data, and try to achieve the development of an application side demo. Development, organize the related information for your reference: 1. HongMeng OS open source projects: www.openatom.org/openharmony 2. HongMeng OS code warehouse: openharmony.gitee.com/ 3. The www.harmonyos.com/cn/home/ website There are code examples, and the development guide 4. The developer center: developer.harmonyos.com/cn/home/ 5. Development and application of tools download address: developer.harmonyos.com/cn/develop/…

After a period of development, you feel two things about me:

1. Development tools are basically the same as Android, including configuration items, SDK, JDK, etc. 2. There are two main ways to develop the technical stack of code: One is Java, which is similar to Android, and the other is JavaScript + HTML + CSS, which is quick for developers.

Environment set up

Have done Java development all know, need to install the development environment, the main is the need to install JDK, but the installation found that Hongmeng APP development will automatically download its own JAR.

For this purpose, if the JDK has been installed, it will be automatically installed when the development tools are installed.

I have installed JDK, directly installed the Hongmon development tool DevEco Studio. Note: Hongmeng development requires installation of Node.js.

Development Tool installation

HongMeng application development needs his own development tool, tool connection I have provided above: application development tools download address: developer.harmonyos.com/cn/develop/…

Current tool version:

DevEco Studio 2.1 Beta3

Download tool

1. Before clicking download, you need to enter huawei authorization and log in to Huawei account. Please prepare the account in advance.

2. After successful download, the file is as follows:

After unpacking the files, there is an installation file as follows, followed by a foolproof installation.

Tool installation -SDK installation and configuration

Installation is a fool to try the installation, visual is idea society version modified or customized tools, but more instructions, a few points need to pay attention to:

1. You are advised to customize the installation directory

2. During the installation, you need to download the SDK and will be prompted with a customized SKD directory. Or skip the download and go to the start surface to set up the update step: Settings -> Search SDK ->HomonyOS SDK

Manually update the SDK renderings after installation:

The SDK information

What information does the SDK have here?

As with Android development, SDK configuration updates include: SDK Platforms and SDK Tools

The following picture is SDK Platforms

Description: The HarmonyOs SDK is categorized by language, including Java, JavaScript, and Native. They allow you to develop applications in Java, javascript, and C/C++. SDKS of the same API version are compatible with each other.

Below is the SDK Tools

Description: a set of HarmonyOs application development tools, including packaging, signing, and previewing

Note that both of the above diagrams need to be downloaded completely when updating the SDK, otherwise the build project will fail.

Here the development tools in accordance with the good, can be created into the project.

Create a project

1. Click Create HarmonyOS Project to Create the Project

2. Select a project

· Default blank page and list display page · Java code or JS code can be selected

3. Add a name and create a directory

4. View the Gradle configuration

Gradle will be updated after the project is created

At present, the default is to update Gradle-6.3 version. This update will be slow. When I update it, I find that it always fails. May be server download too many people, or network problems.

6. Gradle configuration for the whole project

// Top-level build file where you can add configuration options common to all sub-projects/modules.apply plugin: 'com.huawei.ohos.app'ohos { compileSdkVersion 3 defaultConfig { compatibleSdkVersion 3 }} buildscript { repositories { maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } maven { url 'https://developer.huawei.com/repo/' } Jcenter dependencies ()} {the classpath 'com. Huawei. Ohos: hap: 2.0.0.6'}} allprojects {repositories {maven {url 'https://mirrors.huaweicloud.com/repository/maven/' } maven { url 'https://developer.huawei.com/repo/' } jcenter() }}Copy the code

Some of the add-ons are almost the same as on Android, making it easier to get started. · The main change is that the Maven repository has been changed to huawei proprietary, of course, if some three parties or open source use the configuration of the repository can be added.

7. The APP gradle configuration

apply plugin: 'com.huawei.ohos.hap'ohos { compileSdkVersion 3 defaultConfig { compatibleSdkVersion 3 } }dependencies { implementation FileTree (dir: 'libs', include: ['*.jar']) testCompile'junit:junit:4.12'}Copy the code

· Gradle configuration in app is the same as Android, but the version number should follow Hongmeng’s version number.

Download simulator

Click Tools-> HVD Manager in the development tool header to enter the Huawei development platform. You need to log in to the platform.

After login account needs to authenticate developers, can choose id card authentication and bank card authentication.

After id card authenticates, need audit 1-2 days audit period. Bank card authentication is completed on the audit through.

After the authentication is successful, click Tools > HVD Manager. A dialog box is displayed indicating authorization.

Click “Agree” and start to update and download the emulator. The successful interface is as follows:

Run an emulator effect:

Run the project

Once everything is ready, it’s hard to get it to work, because when you create the project, you select an empty default interface, so just a Helloword is displayed.

Run the same as Android run, click the header triangle is to start, bug icon is debug run

Running result:

Now that a complete introduction to Hongmeng development is over, the next article explains the project structure and how to develop in Hongmeng.

Original is not easy, useful attention. I’ll give you a triple if I help you. Thanks for your support.

Feel good friends, remember to help me @ programmer ramble programming **, point a like and follow yo, O lei O lei ~**

Source: the public, “code charge” growth to the author: code working links: the original HongMeng | HongMeng introduction to develop a complete article.

Attached is a programmer’s Must-have booklet, which is copyrighted by the author on GitHub:

Gitee.com/codegrowth/…