HarmonyOS Next App Packaging and Distribution: A Comprehensive Walkthrough
I. Core App Packaging Workflow (Dual Command - Line and Visual Modes)
1. Development Environment Setup
# Install the latest packaging plugin (requires Node.js 20+)
npm install -g @ohos/hap-pack-tools@4.3
2. Signature File Generation (New V3 Signing Mechanism)
// sign-config.json configuration file
{
"version": "3.0", // V3 signature format is mandatory
"bundleName": "com.example.demo",
"certificatePath": "./keys/release.p12",
"provisionProfile": "./profiles/distribution.mobileprovision"
}
3. Multi - Device Type Adaptation
// build.gradle configuration example
harmony {
deviceTypes = [
"phone",
"tablet",
"car" // In - car devices must be declared separately
]
adaptiveLayout { // Adaptive layout configuration
minApiVersion = 12
}
}
4. Compilation and Building Commands
# Full build (generates HAP + App Pack)
hdc build --mode release --bundle-name com.example.demo
# Incremental build (quick packaging after code modifications)
hdc build --incremental --target watch # Specifies wearable device build
5. Output Structure of Artifacts
dist/
├── phone/ # Mobile resources
│ ├── entry-unsigned.hap # Unsigned HAP
│ └── signed.apppack # Signed app package
├── watch/ # Wearable device resources
└── report.html # Build analysis report
II. Dynamic Multi - Bundle Packaging Strategy (New 2025 Feature)
1. On - Demand Loading Configuration
// bundle-config.json
{
"base": { // Main Bundle (must be loaded)
"modules": ["MainAbility"]
},
"dynamic": [ // Dynamic Bundles
{
"name": "payment",
"condition": "device.storage > 128GB", // Loading condition
"prefetch": true // Whether to preload
}
]
}
2. Cloud - Side Bundle Management
# Update dynamic Bundle separately (no need to republish the main package)
hdc update-bundle --name payment --version 2.1.3
III. Detailed Explanation of Main Distribution Channels
1. Huawei AppGallery (Primary Distribution Channel)
-
Review Requirements:
- Cold start time ≤1.8 seconds (flagship device standard)
- Dynamic permissions must be requested with delay (only request when necessary)
- Privacy policy must include AI data processing statement (new 2025 regulation)
-
Publication Process:
- Log in to AppGallery Connect
- Upload App Pack (automatically parses multi - device packages)
- Select phased release strategy (supports gradual release by device model/region)
- Pass AI compliance check (average time 15 minutes)
2. Quick App Distribution Center
// quickapp-config.json configuration
{
"minPlatformVersion": 1200, // Minimum platform version
"instantMode": true, // Enable tap - and - use mode
"preloadRules": { // Preloading strategy
"components": ["PaymentModule"]
}
}
3. Enterprise Private Distribution
# Generate enterprise - dedicated package (with device whitelist)
hdc build --enterprise --device-ids X1Y2Z3,A4B5C6
4. Open - Source Community Distribution
- Must include OSS license declaration file
- Must pass Huawei open - source compliance scan tool check
- Open - source scan command:
hdc oss-check --path ./src --license MIT
IV. Comparison of Distribution Channels
Channel Type | Review Period | Installation Method | Applicable Scenario |
---|---|---|---|
App Market | 2 - 6 hours | Download from app store | General - purpose user distribution |
Quick App | No review | Scan - and - use | Lightweight service scenarios |
Enterprise Distribution | Instant | Private link/QR code | Internal system integration |
Open - Source Community | Manual review | Source code compilation | Developer ecosystem building |
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.