harmony 鸿蒙Shared Package Overview

  • 2023-06-24
  • 浏览 (744)

Shared Package Overview

OpenHarmony provides two types of shared packages: Harmony Archive (HAR) static shared package and Harmony Shared Package (HSP) dynamic shared package.

Both the HAR and HSP are used to share code and resources and can contain code, C++ libraries, resources, and configuration files. The biggest differences between them are as follows: The code and resources in the HAR are compiled with the invoking module, and if there are multiple invoking modules, the build product contains multiple copies of the same code and resources; the code and resources in the HSP can be compiled independently, and the build product contains only one copy of the code and resources.

Figure 1 HAR and HSP in the App Pack

in-app-hsp-har

The HSP aims to resolve the App Pack bloat resulting from multiple HAP files referencing the same HAR.

Restrictions on the HSP: - The HSP and its invoking modules must be in the stage model. - The HSP and its invoking modules must use the esmodule compilation mode. - The HSP does not support the declaration of abilities and extensionAbilities in its configuration file.

The HSP can be classified as in-application HSP or inter-application HSP, which will be supported in later versions.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Quick Start

harmony 鸿蒙app.json5 Configuration File

harmony 鸿蒙Internal Structure of the app Tag

harmony 鸿蒙Application Configuration File Overview (FA Model)

harmony 鸿蒙Application Configuration File Overview (Stage Model)

harmony 鸿蒙Application Installation and Uninstallation Process

harmony 鸿蒙Application Package Overview

harmony 鸿蒙Application Package Structure in FA Model

harmony 鸿蒙Application Package Structure in Stage Model

harmony 鸿蒙Application Package Update Process

0  赞