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.

Test the library with a sample application

  1. First let's "build" the package by selecting "Build" from the Menu option and then select "Build Bundles/APK" and "Build APK" as shown in the below screenshot (Image 5).
  • Image 5

Sometimes the build Bundles/APK option would be disabled, in those scenarios you can perform it manually from the terminal using "gradlew clean build" as shown below (Image 6).

  • Image 6

  1. After it is built successfully, you will find the latest "Sample.debug.apk" file available in the "Sample-> build-> outputs->apk-> debug" folder.
  2. You can use this APK and run on any of the emulators to view the sample application of the library usage.
  3. Once the APK file is up running on the emulator you should be able to view the library behavior as shown below (Image 7).
  • Image 7

Until now we have selected a library, imported to Android studio, synced up and successfully run the sample Application using the APK file on the Emulator.