The integrated HSP is an intermediate build product of the intra-application HSP. It aims to solve the strong coupling between the bundle name and signature of the user.
The HSP can be used only by projects with the same bundle name, but the integrated HSP can be used by projects with different bundle names.
When using the integrated HSP, the user needs to re-sign the integrated HSP with the signature file and install the re-signed integrated HSP first.
If multiple apps contain the same basic capabilities, for example, a log printing module, they can share one log module to reduce development costs and implement code and resource sharing. In this case, the capabilities can be provided through an in-app HSP. Due to the limitations of in-app HSPs, each app must adjust its bundleName before use and re-sign it with the current app's signature to build a new HSP for the current app. This means that each additional app requires an adjustment of the bundleName and a re-signing operation, making the signing and packaging process cumbersome. With an integrated HSP, however, the bundleName adjustment and re-signing are automatically completed during compilation in DevEco Studio, so you do not need to worry about repeated signing and can focus on feature development.
The integrated HSP is only available for the stage model.
The integrated HSP is supported since API version 12.
The integrated HSP must use the standardized OHMUrl format. You need to set the useNormalizedOHMUrl field under strictMode to true in the project-level build-profile.json5 file.
Project configuration: Set useNormalizedOHMUrl to true in the project-level build-profile.json5 file.
{
"app": {
"signingConfigs": [
],
"products": [
{
"name": "default",
"signingConfig": "default",
"targetSdkVersion": 19,
"compatibleSdkVersion": 19,
"compileSdkVersion": 19,
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
// ...
"useNormalizedOHMUrl": true,
}
}
}
],
// ...
},
// ...
} Module configuration: Set integratedHsp to true in the module-level build-profile.json5 file to specify the built HSP module as the integrated HSP.
// library/build-profile.json5
{
"apiType": "stageMode",
// ...
"buildOptionSet": [
{
// ...
"arkOptions": {
"integratedHsp": true,
// ...
},
},
],
// ...
} Package the configuration (.tgz package).
(1) Configure the project signing information. For details, see Configuring a Debug Signature.
(2) Configure the release mode.

(3) Select the library directory and choose Build > Make Module 'library'.
Directory creation and file copying: Create a libs directory under the entry directory and copy the .tgz package to the created directory.
Project dependency configuration: Add dependencies to the oh-package.json5 configuration file of the main module of the user.
"dependencies": {
"library": "file:./libs/library-default.tgz"
}, Project configuration: Set useNormalizedOHMUrl to true in the project-level build-profile.json5 file.
{
"app": {
"signingConfigs": [
],
"products": [
{
"name": "default",
"signingConfig": "default",
"targetSdkVersion": 19,
"compatibleSdkVersion": 19,
"compileSdkVersion": 19,
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
// ...
"useNormalizedOHMUrl": true,
}
}
}
],
// ...
},
// ...
} Configure the signature.
Before installing and running the app, you must configure the project signing information. For details, see Configuring a Debug Signature.