Compare commits
4 Commits
306be63b7c
...
9816e5fe82
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9816e5fe82 | ||
|
|
f5b575c0df | ||
|
|
8aa8fd567e | ||
|
|
ab3ba1e8a0 |
@@ -10,17 +10,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
|
|
||||||
- **harmonyos-build-deploy**: Translated Chinese UI strings to English in SKILL.md
|
- **harmonyos-build-deploy**: Translated Chinese UI strings to English in SKILL.md
|
||||||
- **harmonyos-build-deploy**: Removed agent-framework coupling (question() tool, Task() subagent references) — workflows are now framework-agnostic but marked for subagent delegation
|
- **harmonyos-build-deploy**: Removed agent-framework coupling (question() tool, Task() subagent references) — workflows are now framework-agnostic but marked for subagent delegation
|
||||||
- **harmonyos-build-deploy**: Deduplicated content between SKILL.md and device-installation.md — reference file now focuses on version verification, install script, and detailed troubleshooting
|
- **harmonyos-build-deploy**: Deduplicated content between SKILL.md and device-installation.md — reference file now focuses on version verification and install script
|
||||||
- **harmonyos-build-deploy**: Fixed module type identification — now uses `module.json5` `type` field instead of heuristic based on `targets` presence
|
- **harmonyos-build-deploy**: Fixed module type identification — now uses `module.json5` `type` field instead of heuristic based on `targets` presence
|
||||||
- **harmonyos-build-deploy**: Extracted module discovery, build outputs, and unwanted modules into `references/module-discovery.md` (~138 lines moved out of SKILL.md)
|
- **harmonyos-build-deploy**: Extracted module discovery, build outputs, and unwanted modules into `references/module-discovery.md` (~138 lines moved out of SKILL.md)
|
||||||
- **harmonyos-build-deploy**: Fixed unquoted variable in install.sh script
|
- **harmonyos-build-deploy**: Fixed unquoted variable in install.sh script
|
||||||
|
- **harmonyos-build-deploy**: Deploy Only workflow now checks for empty output directory and collects signed artifacts from module build directories
|
||||||
|
- **harmonyos-build-deploy**: Simplified build output path from `outputs/default/bundles/signed/` to `outputs/`
|
||||||
|
- **harmonyos-build-deploy**: Device push now filters by `.hap`/`.hsp` extension instead of sending entire directory
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- **harmonyos-build-deploy**: Wireless debugging (hdc tconn) section — environment setup, not build/deploy
|
- **harmonyos-build-deploy**: Wireless debugging (hdc tconn) section — environment setup, not build/deploy
|
||||||
- **harmonyos-build-deploy**: Restart App workflow — runtime operation, not build/deploy
|
- **harmonyos-build-deploy**: Restart App workflow — runtime operation, not build/deploy
|
||||||
- **harmonyos-build-deploy**: `aa dump -a` command — runtime debugging, not build/deploy
|
- **harmonyos-build-deploy**: `aa dump -a` command — runtime debugging, not build/deploy
|
||||||
- **harmonyos-build-deploy**: Duplicate Build Output Structure from device-installation.md (already in SKILL.md and module-discovery.md)
|
- **harmonyos-build-deploy**: Build Types section — redundant with Single Module Build and Module Types table
|
||||||
|
- **harmonyos-build-deploy**: Duplicate installation workflow and troubleshooting from device-installation.md (consolidated into SKILL.md)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -39,12 +39,15 @@ hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-
|
|||||||
# Use a random directory name to avoid conflicts with previous installations
|
# Use a random directory name to avoid conflicts with previous installations
|
||||||
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
||||||
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
||||||
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR
|
# Only push .hap and .hsp files
|
||||||
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed"
|
for f in outputs/*.hap outputs/*.hsp; do
|
||||||
|
[ -f "$f" ] && hdc -t <UDID> file send "$f" $INSTALL_DIR/
|
||||||
|
done
|
||||||
|
hdc -t <UDID> shell "bm install -p $INSTALL_DIR"
|
||||||
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** Build output path is `outputs/default/bundles/signed/`.
|
**Note:** Build output path is `outputs/`.
|
||||||
|
|
||||||
## Workflows
|
## Workflows
|
||||||
|
|
||||||
@@ -57,33 +60,19 @@ Delegate to subagent with the following steps:
|
|||||||
1. Clean: `hvigorw clean --no-daemon`
|
1. Clean: `hvigorw clean --no-daemon`
|
||||||
2. Install dependencies: `ohpm install --all`
|
2. Install dependencies: `ohpm install --all`
|
||||||
3. Build: `hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon`
|
3. Build: `hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon`
|
||||||
4. Build output is at `outputs/default/bundles/signed/`
|
4. Deploy to device (see [Push and Install](#push-and-install) below)
|
||||||
5. Deploy to device:
|
5. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"`
|
||||||
```bash
|
6. Report success/failure with details
|
||||||
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
|
||||||
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
|
||||||
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR
|
|
||||||
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed"
|
|
||||||
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
|
||||||
```
|
|
||||||
6. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"`
|
|
||||||
7. Report success/failure with details
|
|
||||||
|
|
||||||
### Deploy Only (No Rebuild)
|
### Deploy Only (No Rebuild)
|
||||||
|
|
||||||
Delegate to subagent with the following steps:
|
Delegate to subagent with the following steps:
|
||||||
|
|
||||||
1. Read `AppScope/app.json5` to get bundleName
|
1. Read `AppScope/app.json5` to get bundleName
|
||||||
2. Push existing build output to device:
|
2. Check `outputs/` for existing build outputs. If empty or missing, collect signed HAP/HSP from each module's build directory (`{srcPath}/build/default/outputs/default/*-signed.*`) into `outputs/`. See [module-discovery.md](references/module-discovery.md) for details.
|
||||||
```bash
|
3. Deploy to device (see [Push and Install](#push-and-install) below)
|
||||||
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
4. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"`
|
||||||
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
5. Report success/failure with details
|
||||||
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR
|
|
||||||
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed"
|
|
||||||
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
|
||||||
```
|
|
||||||
3. Launch: `hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"`
|
|
||||||
4. Report success/failure with details
|
|
||||||
|
|
||||||
### Clean App Cache/Data
|
### Clean App Cache/Data
|
||||||
|
|
||||||
@@ -170,15 +159,6 @@ Only needed after modifying `build-profile.json5` or `oh-package.json5`:
|
|||||||
hvigorw --sync -p product=default -p buildMode=release --no-daemon
|
hvigorw --sync -p product=default -p buildMode=release --no-daemon
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build Types
|
|
||||||
|
|
||||||
```bash
|
|
||||||
hvigorw assembleHap # Build HAP (Harmony Ability Package)
|
|
||||||
hvigorw assembleHsp # Build HSP (Harmony Shared Package)
|
|
||||||
hvigorw assembleHar # Build HAR (Harmony Archive)
|
|
||||||
hvigorw assembleApp # Build complete APP bundle
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Parameters
|
### Build Parameters
|
||||||
|
|
||||||
| Parameter | Description |
|
| Parameter | Description |
|
||||||
@@ -193,10 +173,10 @@ hvigorw assembleApp # Build complete APP bundle
|
|||||||
|
|
||||||
## Build Outputs
|
## Build Outputs
|
||||||
|
|
||||||
Build output path: `outputs/default/bundles/signed/`
|
Build output path: `outputs/`
|
||||||
|
|
||||||
```
|
```
|
||||||
outputs/default/bundles/signed/
|
outputs/
|
||||||
├── entry-default-signed.hap
|
├── entry-default-signed.hap
|
||||||
└── *.hsp
|
└── *.hsp
|
||||||
```
|
```
|
||||||
@@ -242,11 +222,13 @@ hdc -t <UDID> shell "whoami" # Test connection
|
|||||||
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
||||||
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
||||||
|
|
||||||
# Push signed bundles
|
# Only push .hap and .hsp files
|
||||||
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR
|
for f in outputs/*.hap outputs/*.hsp; do
|
||||||
|
[ -f "$f" ] && hdc -t <UDID> file send "$f" $INSTALL_DIR/
|
||||||
|
done
|
||||||
|
|
||||||
# Install all HAP/HSP in directory
|
# Install all HAP/HSP in directory
|
||||||
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed"
|
hdc -t <UDID> shell "bm install -p $INSTALL_DIR"
|
||||||
|
|
||||||
# Clean up temp directory
|
# Clean up temp directory
|
||||||
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
||||||
@@ -308,11 +290,11 @@ Run via `hdc -t <UDID> shell "aa ..."`:
|
|||||||
|
|
||||||
| Error | Cause | Solution |
|
| Error | Cause | Solution |
|
||||||
|-------|-------|----------|
|
|-------|-------|----------|
|
||||||
| `version code not same` | HSP in output not in build-profile.json5 | Remove unwanted HSP files before install |
|
| `version code not same` | HSP in output not in build-profile.json5 | Remove unwanted HSP files before install (see [module-discovery.md](references/module-discovery.md)) |
|
||||||
| `install parse profile prop check error` | Signature/profile mismatch | Check signing config in build-profile.json5 |
|
| `install parse profile prop check error` | Signature/profile mismatch | Check signing config in build-profile.json5; verify bundleName matches app.json5; check certificate not expired |
|
||||||
| `install failed due to older sdk version` | Device SDK < app's compatibleSdkVersion | Update device or lower compatibleSdkVersion |
|
| `install failed due to older sdk version` | Device SDK < app's compatibleSdkVersion | Update device or lower compatibleSdkVersion |
|
||||||
| Device not found | Connection issue | Check USB, enable debugging, `hdc kill && hdc start` |
|
| Device not found | Connection issue | Check USB; enable Developer Options (tap build number 7x) and USB debugging; `hdc kill && hdc start`; try different USB port/cable |
|
||||||
| `signature verification failed` | Invalid or expired certificate | Regenerate signing certificate |
|
| `signature verification failed` | Invalid or expired certificate | Regenerate certificate in DevEco Studio; check validity period; ensure correct signing config for build type |
|
||||||
|
|
||||||
## Key Configuration Files
|
## Key Configuration Files
|
||||||
|
|
||||||
@@ -326,7 +308,7 @@ Run via `hdc -t <UDID> shell "aa ..."`:
|
|||||||
## Reference Files
|
## Reference Files
|
||||||
|
|
||||||
- **Module Discovery & Build Outputs**: [references/module-discovery.md](references/module-discovery.md) - Module definitions, type identification, build output paths, unwanted modules
|
- **Module Discovery & Build Outputs**: [references/module-discovery.md](references/module-discovery.md) - Module definitions, type identification, build output paths, unwanted modules
|
||||||
- **Complete Installation Guide**: [references/device-installation.md](references/device-installation.md) - Detailed troubleshooting, version verification scripts, and installation script
|
- **Complete Installation Guide**: [references/device-installation.md](references/device-installation.md) - Version verification scripts and installation script
|
||||||
|
|
||||||
## Related Skills
|
## Related Skills
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Device Installation Guide
|
# Device Installation Guide
|
||||||
|
|
||||||
Detailed guide for packaging and installing HarmonyOS applications to physical devices. This supplements the main [SKILL.md](../SKILL.md) with deeper troubleshooting, version verification, and an installation script.
|
Detailed guide for verifying build outputs and automating device installation. This supplements the main [SKILL.md](../SKILL.md) with version verification scripts and an installation script.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -18,14 +18,14 @@ All HAP/HSP modules must have the **same versionCode**. Mismatched versions caus
|
|||||||
# Using Python (cross-platform)
|
# Using Python (cross-platform)
|
||||||
python3 -c "
|
python3 -c "
|
||||||
import zipfile, json, glob
|
import zipfile, json, glob
|
||||||
for f in glob.glob('outputs/default/bundles/signed/*.hsp'):
|
for f in glob.glob('outputs/*.hsp'):
|
||||||
z = zipfile.ZipFile(f)
|
z = zipfile.ZipFile(f)
|
||||||
data = json.loads(z.read('module.json'))
|
data = json.loads(z.read('module.json'))
|
||||||
print(f\"{f.split('/')[-1]}: versionCode = {data['app']['versionCode']}\")
|
print(f\"{f.split('/')[-1]}: versionCode = {data['app']['versionCode']}\")
|
||||||
"
|
"
|
||||||
|
|
||||||
# Using unzip + grep (Linux/macOS)
|
# Using unzip + grep (Linux/macOS)
|
||||||
for f in outputs/default/bundles/signed/*.hsp; do
|
for f in outputs/*.hsp; do
|
||||||
echo -n "$(basename $f): "
|
echo -n "$(basename $f): "
|
||||||
unzip -p "$f" module.json | grep -o '"versionCode":[0-9]*'
|
unzip -p "$f" module.json | grep -o '"versionCode":[0-9]*'
|
||||||
done
|
done
|
||||||
@@ -40,55 +40,7 @@ A module should be removed from the output before installation if:
|
|||||||
3. Module versionCode differs from `AppScope/app.json5`
|
3. Module versionCode differs from `AppScope/app.json5`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rm outputs/default/bundles/signed/problematic-module-default-signed.hsp
|
rm outputs/problematic-module-default-signed.hsp
|
||||||
```
|
|
||||||
|
|
||||||
## Complete Installation Workflow
|
|
||||||
|
|
||||||
### Step 1: Check Device Connection
|
|
||||||
|
|
||||||
```bash
|
|
||||||
hdc list targets
|
|
||||||
# Output: device UDID (e.g., 1234567890ABCDEF)
|
|
||||||
```
|
|
||||||
|
|
||||||
If no device found:
|
|
||||||
1. Check USB connection
|
|
||||||
2. Enable Developer Options on device: Settings > About > Tap build number 7 times
|
|
||||||
3. Enable USB debugging: Settings > Developer options > USB debugging
|
|
||||||
4. Run `hdc kill && hdc start` to restart hdc server
|
|
||||||
|
|
||||||
### Step 2: Push Files to Device
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create random temp directory on device
|
|
||||||
INSTALL_DIR="/data/local/tmp/install_$(date +%s)"
|
|
||||||
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
|
|
||||||
|
|
||||||
# Push signed HAP/HSP files
|
|
||||||
hdc -t <UDID> file send outputs/default/bundles/signed $INSTALL_DIR
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3: Install Application
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install all HAP/HSP from directory
|
|
||||||
hdc -t <UDID> shell "bm install -p $INSTALL_DIR/signed"
|
|
||||||
|
|
||||||
# Expected output: "install bundle successfully."
|
|
||||||
|
|
||||||
# Clean up temp directory
|
|
||||||
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 4: Verify and Launch
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check package info
|
|
||||||
hdc -t <UDID> shell "bm dump -n <bundleName>"
|
|
||||||
|
|
||||||
# Launch application
|
|
||||||
hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Installation Script
|
## Quick Installation Script
|
||||||
@@ -100,7 +52,7 @@ Save as `install.sh` (Linux/macOS) or run with Git Bash on Windows:
|
|||||||
|
|
||||||
# === Configuration ===
|
# === Configuration ===
|
||||||
DEVICE_ID="${1:-$(hdc list targets | head -1)}"
|
DEVICE_ID="${1:-$(hdc list targets | head -1)}"
|
||||||
SIGNED_PATH="${2:-outputs/default/bundles/signed}"
|
SIGNED_PATH="${2:-outputs}"
|
||||||
BUNDLE_NAME="${3:-}"
|
BUNDLE_NAME="${3:-}"
|
||||||
REMOTE_PATH="/data/local/tmp/install_$(date +%s)"
|
REMOTE_PATH="/data/local/tmp/install_$(date +%s)"
|
||||||
|
|
||||||
@@ -116,12 +68,13 @@ echo "Remote: $REMOTE_PATH"
|
|||||||
# === Create remote directory ===
|
# === Create remote directory ===
|
||||||
hdc -t "$DEVICE_ID" shell "mkdir -p $REMOTE_PATH"
|
hdc -t "$DEVICE_ID" shell "mkdir -p $REMOTE_PATH"
|
||||||
|
|
||||||
# === Push signed files ===
|
# === Push only .hap and .hsp files ===
|
||||||
hdc -t "$DEVICE_ID" file send "$SIGNED_PATH" "$REMOTE_PATH"
|
for f in "$SIGNED_PATH"/*.hap "$SIGNED_PATH"/*.hsp; do
|
||||||
|
[ -f "$f" ] && hdc -t "$DEVICE_ID" file send "$f" "$REMOTE_PATH/"
|
||||||
|
done
|
||||||
|
|
||||||
# === Install ===
|
# === Install ===
|
||||||
BASENAME="$(basename "$SIGNED_PATH")"
|
hdc -t "$DEVICE_ID" shell "bm install -p $REMOTE_PATH"
|
||||||
hdc -t "$DEVICE_ID" shell "bm install -p $REMOTE_PATH/$BASENAME"
|
|
||||||
|
|
||||||
# === Clean up ===
|
# === Clean up ===
|
||||||
hdc -t "$DEVICE_ID" shell "rm -rf $REMOTE_PATH"
|
hdc -t "$DEVICE_ID" shell "rm -rf $REMOTE_PATH"
|
||||||
@@ -146,57 +99,8 @@ Usage:
|
|||||||
./install.sh 1234567890ABCDEF
|
./install.sh 1234567890ABCDEF
|
||||||
|
|
||||||
# Specify device and path
|
# Specify device and path
|
||||||
./install.sh 1234567890ABCDEF outputs/default/bundles/signed
|
./install.sh 1234567890ABCDEF outputs
|
||||||
|
|
||||||
# Specify device, path, and bundle name (auto-launch)
|
# Specify device, path, and bundle name (auto-launch)
|
||||||
./install.sh 1234567890ABCDEF outputs/default/bundles/signed com.example.app
|
./install.sh 1234567890ABCDEF outputs com.example.app
|
||||||
```
|
```
|
||||||
|
|
||||||
## Troubleshooting Details
|
|
||||||
|
|
||||||
### Error: "version code not same"
|
|
||||||
|
|
||||||
**Cause:** Some HAP/HSP modules have different versionCode than others.
|
|
||||||
|
|
||||||
**Solution:**
|
|
||||||
1. Use the version check commands above to find modules with different versionCode
|
|
||||||
2. Remove those modules from signed directory before installation
|
|
||||||
3. Usually caused by precompiled modules not in build-profile.json5
|
|
||||||
|
|
||||||
### Error: "install parse profile prop check error"
|
|
||||||
|
|
||||||
**Cause:** Signature or profile configuration mismatch.
|
|
||||||
|
|
||||||
**Solution:**
|
|
||||||
1. Check signing config in `build-profile.json5`
|
|
||||||
2. Ensure certificate and profile match
|
|
||||||
3. Verify profile bundleName matches app.json5 bundleName
|
|
||||||
4. Check certificate is not expired
|
|
||||||
|
|
||||||
### Error: Device not found
|
|
||||||
|
|
||||||
**Cause:** Connection or hdc service issue.
|
|
||||||
|
|
||||||
**Solution:**
|
|
||||||
1. Check USB cable connection
|
|
||||||
2. Enable Developer Options: Settings > About > Tap build number 7 times
|
|
||||||
3. Enable USB debugging: Settings > Developer options > USB debugging
|
|
||||||
4. Restart hdc server: `hdc kill && hdc start`
|
|
||||||
5. Try different USB port or cable
|
|
||||||
|
|
||||||
### Error: "install failed due to older sdk version in the device"
|
|
||||||
|
|
||||||
**Cause:** Device system version is lower than app's minimum requirement.
|
|
||||||
|
|
||||||
**Solution:**
|
|
||||||
1. Update device to latest system version
|
|
||||||
2. Or lower `compatibleSdkVersion` in `build-profile.json5`
|
|
||||||
|
|
||||||
### Error: "signature verification failed"
|
|
||||||
|
|
||||||
**Cause:** Certificate issues.
|
|
||||||
|
|
||||||
**Solution:**
|
|
||||||
1. Regenerate debug/release certificate in DevEco Studio
|
|
||||||
2. Check certificate validity period
|
|
||||||
3. Ensure using correct signing config for build type
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ Sometimes HSP files appear in the output directory that are **not listed in `bui
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Example: Remove modules not in build-profile.json5
|
# Example: Remove modules not in build-profile.json5
|
||||||
rm outputs/default/bundles/signed/unwanted-module-default-signed.hsp
|
rm outputs/unwanted-module-default-signed.hsp
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** Installation will fail with "version code not same" error if these unwanted modules have a different versionCode than the main app. The root cause is that these modules shouldn't be deployed at all.
|
**Note:** Installation will fail with "version code not same" error if these unwanted modules have a different versionCode than the main app. The root cause is that these modules shouldn't be deployed at all.
|
||||||
|
|||||||
Reference in New Issue
Block a user