Moment For Technology

This comprehensive guide to the HarmonyOS open source component library is not easy to learn

Posted on Aug. 8, 2022, 7:03 p.m. by Aaryahi Keer
Category: The development tools Tag: HongMeng OS

HarmonyOS provides more than 16,000 apis. In addition to these apis, HarmonyOS also provides a series of component libraries that make application development easier and more efficient.

The HarmonyOS library is directly available on the OpenHarmony open source community, and Huawei is still expanding it. What is the HarmonyOS component library that works so well? We can understand it from the following five aspects.

Introduction to the HarmonyOS component library

In 2021, HarmonyOS will roll out 1,000 + components, including UI, animated graphics, frameworks, security, tools, networking, file data, multimedia, image caching, and basic functionality in 10 categories (see figure below) that feature multi-device scalability, multi-terminal deployment, and performance optimization.

HarmonyOS Component Project directory structure

The HarmonyOS project directory structure is similar to that of the Java project. The HarmonyOS project directory consists of a build directory, a LiBS dependent library directory, a SRC source directory, and build scripts.

DevEco Studio, HarmonyOS's IDE tool, allows developers to develop projects directly with components. Simply open a specified template and the associated directory structure is automatically imported into the project file.

Low DevEco Studio download links: developer.harmonyos.com/cn/develop/...

3. How components are referenced

Common components can be referenced in the following three ways:

1.Har package reference (build.gradle)

Binary directory references are straightforward, and developers need only place component libraries in the LIBS directory. Prototyping is very convenient and is a common way for beginners or testers.

dependencies {

implementation project(":mylibrary")

}

  1. Source file references (build.gradle)

When developers need to optimize the components they use, they can reference the source file, download the source code, and synchronize the changes. After optimization, you can also contribute the source code to the open source warehouse.

dependencies {

implementation fileTree(dir: 'libs', include: ['.jar', '.har'])

}

  1. Maven storehouse reference (build.gradle)

Maven repository references are suitable for large-scale team development or commercial application development, and developers can download them directly from the central repository.

Step one:

allprojects{

repositories {

maven {

Url 'file://D:/01.localMaven/' // local or remote Maven repository

}

}

}

Step 2:

dependencies {

Implementation 'com. Huawei. Har: mylibrary: 1.0.1'

}

How to obtain the component library

Developers can download the source code from OpenHarmony Gitee or from the HarmonyOS component library documentation.

  1. Component library source path

●Gitee open Source link: gitee.com/openharmony...

  1. Path to obtain component library documents

HarmonyOS provides a unified management platform for the HarmonyOS component library, which makes it easy to query documents.

● Link: hpm.harmonyos.com/hapm/

5. Demo effect display of some components

  1. BezierMaker: Simple Bezier curve drawing method

● Download the source code at gitee.com/openharmony...

  1. Cardslib: Card layout library

● Download the source code at gitee.com/openharmony...

  1. Confetti mimics the falling snow

● Download the source code at gitee.com/openharmony...

  1. FileDownloader: file download library

● Download the source code at gitee.com/openharmony...

From this introduction and description, you should have a basic understanding of how the HarmonyOS component library works. The HarmonyOS library helps developers develop their apps more efficiently, but it also requires constant feedback, additions and improvements. The HarmonyOS ecosystem needs more developers to grow and flourish.

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.