APP
Filename extension
.app,.hap
Developed byHuawei
Type of formatPackage format
Container for
Extended fromJAR

The HarmonyOS App Pack or the App file, identified with the file extension ".app", serves as the file format used by the HarmonyOS operating system. It functions as a native HarmonyOS app for distribution and installation through Huawei AppGallery,[1] or for distribution through Huawei Ability Gallery in respect of installation-free apps. The App file is also used by a number of other open source HarmonyOS-based operating systems such as OpenHarmony for distribution and installation of mobile apps, mobile games and middleware. Including non OpenHarmony-based operating systems, such as GNU Linux-based Unity Operating System that supports the app file format.[2] [3][4][5][6]

Each HarmonyOS app contains one or more HarmonyOS Ability Package (HAP) files with the file extension ".hap",[7] and the pack.info file that describes the attributes of the App file.[8]

Most HarmonyOS apps contain at least one HAP file of the entry type, which is the main module of the app, and additional HAP files of the feature type, which is used to implement a specific app feature.[8]

Overview

App Pack and HAP files

HarmonyOS apps are distributed as a software package file known as the App Pack or the App file, suffixed with .app, which is analogous to other software packages such as apk used by the Android operating system, appx in Microsoft Windows, or a Debian package in Debian-based operating systems.

To make a HarmonyOS app, a software development tool such as DevEco Studio is required to code and pack HarmonyOS Ability Package (HAP) and associated files into an app package.[9]

The HAP files may consist of resources, third-party libraries and configuration files. They are classified into two types of modules, i.e., entry and feature. The entry type of the HAP files is the main module and must be included into an app package, while the feature type of the HAP files is additional modules for implementing the features of the apps.

Moreover, an App file that contains different builds and specifications optimized for the various devices may contain more than one HAP file of the entry type.[3]

Prior to packing into an App Pack, HAP files are allowed to run directly on a real device or an emulator for developers to debug and verify the apps during the development phase.[10]

After development, the apps containing signature information can be distributed to different devices with AppGallery Connect, a tool kit of services for creation, development, distribution and maintenance of an app.[11]

Shared packages

HarmonyOS Shared Packages

For sharing code and resources in an App Pack, the operating system offers two kinds of shared packages: Harmony Archive (HAR), which is a static shared package, and Harmony Shared Package (HSP), which is a dynamic shared package.[12]

Both HAR and HSP enable sharing of code, C++ libraries, resources, and configuration files. In HAR, the code and resources are compiled together with invoking modules, possibly resulting in multiple copies of the same code and resources. In contrast, HSP allows independent compilation, leading to only one copy of code and resources in the build product.[12]

When multiple HAPs reference the same HAR, the HSP can be used instead to share some state variables and reduce the size of an App Pack. However, the HSP has some restrictions; for example, it does not support the declaration of abilities in its configuration file and its invoking modules must be in the same stage model as with the HSP.[12]

App file structure

The structure of the App file after built and packaged in a stage model usually contains the following files and folders.[8]

  • entry.hap and feature.hap: the basic modules of both entry and feature types for installing an app, containing the following folders and files.
    • ets: a folder storing bytecode files generated after the code build.
    • libs: a folder storing the dependency files of the main module.
    • resources: a folder containing resource files such as graphics, multimedia, character strings, and layouts.
    • resources.index: a file providing a resource index table generated when an app is built.
    • app.json5 and module.json5: JSON files with configuration information for build tools, operating system and application markets.[13]
  • pack.info: a file describing the attributes of the App Pack.

See also

References

  1. "HarmonyOS Project Overview". developer.harmonyos.com. Retrieved 2023-08-23.
  2. "UOS could support HarmonyOS hap app format". HC Newsroom. Retrieved 15 January 2024.
  3. 1 2 "Application Fundamentals". developer.harmonyos.com. Retrieved 2023-08-20.
  4. "What Is an Atomic Service". developer.harmonyos.com. Retrieved 2023-08-20.
  5. Li, Deng (2022-11-28). "Orange Pi OS launched, based on Huawei HarmonyOS". Huawei Central. Retrieved 2023-11-30.
  6. Anand, Abhinav (2023-11-13). "Huawei ditches Android with HarmonyOS Next". Android Headlines. Retrieved 2023-12-09.
  7. "HAP File - What is a .hap file and how do I open it?". fileinfo.com. Retrieved 2023-08-20.
  8. 1 2 3 "Application Package Structure in Stage Model". developer.harmonyos.com. Retrieved 2023-08-20.
  9. "HUAWEI DevEco Studio - HUAWEI HarmonyOS APP". developer.harmonyos.com. Retrieved 2023-08-20.
  10. "Overview - Building Your App". developer.harmonyos.com. Retrieved 2023-08-20.
  11. "Overview - AppGallery Connect". developer.huawei.com. Retrieved 2023-08-20.
  12. 1 2 3 "Shared Package Overview". developer.harmonyos.com. Retrieved 2023-09-27.
  13. "Application Configuration File Overview (Stage Model)". developer.harmonyos.com. Retrieved 2023-08-21.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.