HMOS Lib Porting Guide

android hmos library app development
HMOS Lib Porting Guide


     HarmonyOS is an operating systems developed by Huawei. It was described as a microkernel-based, distributed, embedded operating system designed to work on devices from IoT and smart home products to wearables, in-car infotainment systems, and mobile devices - including smartphones.           


This document will provide a step-by-step guide to develop libraries for Harmony OS, in order to develop the libraries, it is good to have a fair understanding of Android, HarmonyOS or iOS Architecture.

Initial this document gives us a brief introduction about Android and Harmony Architecture and some deep understanding of the related API. Also, it is good to understand the key difference and information which is needed for developing libraries for HarmonyOS.

In depth view of developing library for HarmonyOS

          Until now we have learnt the basics of various platforms, the importance of libraries and how to create one. We have also seen the deep dive feature of HarmonyOS ranging from Architecture and the unique features of it.

Later we have also seen how HarmonyOS architecture is unique when compared to the rest, I think it's time to start porting libraries to HarmonyOS and the next section will help you to guide step by step to achieve this.

Note: We have set of selected libraries for you to start porting and here is the link

Now you must have chosen a library from the above list and just before you start the library porting, we need a certain checklist to be met and below are the listed ones.

  1. The library should be purely written in Java and you can find how to look for one as shown in the below screenshot (Image 1).

  1. Make sure the package commits are recent, ensure it is maintained and not deprecated. (Note: you can find these details in the section of the Package). This helps us to understand whether you should port it completely or what is the process that needs to be followed.

Below are some examples of a deprecated library -

  1. Next, we need to look for the licensing details of the package, ensure it is not private, and it is open sourced and free to use. Also, we make sure the library doesn't use licenses which restricts us from using this, modifying or publishing.

Most of the packages will have a license.txt file which will give complete details about the permissions or liabilities that need to be checked.

More details about licensing can be found here

  1. Look for the dependencies in the build.gradle as shown below (Image 2). We have 2 build.gradle for every application , one is "Module" level, okand one is "Project" level. Here we need to look for "Module" level and the path is <PROJECT_ROOT>\app\build.gradle
  • Image 2

  1. If it contains dependency libraries or external packages that are not ported, we should port that as well, make sure these checks are performed before porting one.

In this document for demonstration purposes, I will be using the Android library "CircleImageView" and show you how to port to HarmonyOS and build applications successfully.

More details about the library can be found here.

Below is the list of actions to be performed while porting a library and as mentioned earlier I'm using "CircleImageView" for demonstration purposes.

  1. We will first get the local copy of the "CircleImageView" package. You can find the latest version here.
  2. Click on the latest version and download the "Source Code (Zip)" file as shown below. (Please Note: Incase if the selected package is migrated to Kotlin version then select the version prior to it for the porting).
  3. Run a sample app to see if the library is running fine on Android Device with Android Studio.
  4. Then will start with the porting process to HarmonyOS using DevEco Studio.
  5. Build, Test the ported library by creating a sample application in DevEco Studio