Ohos app build debug

From openharmonyinsight/openharmony-skills · View interactive version

Ohos app build debug is an AI agent skill from the GitHub repository openharmonyinsight/openharmony-skills. Build, install, launch, and debug HarmonyOS/OpenHarmony applications using DevEco Studio toolchain. Use when Claude needs to: (1) Build OHOS apps with hvigorw, (2) Install HAP files to devices via hdc, (3) Launch or debug OHOS applications, (4) Parse crash stacks with hstack, (5) Take device screens

How to use this skill

Skill file

OHOS App Build & Debug

When to Use This Skill

Use this skill when the user needs to work with HarmonyOS/OpenHarmony applications:

Quick Start

Build, install, and launch an OHOS application:

# Run scripts from skill directory
python3 $SKILL_DIR/scripts/build.py
python3 $SKILL_DIR/scripts/install.py -f entry/build/default/outputs/default/entry-default-signed.hap
python3 $SKILL_DIR/scripts/launch.py

Bundled Resources

This skill includes executable scripts in scripts/ that automatically detect DevEco Studio environment:

| Script | Purpose |

|--------|---------|

| build.py | Build OHOS application using hvigorw |

| install.py | Install HAP file to connected device |

| launch.py | Launch installed application |

| screenshot.py | Capture device screenshot |

| parse_crash.py | Parse crash stack using hstack |

| env_detector.py | Detect DevEco Studio and tools |

| ohos_utils.py | Shared utility functions |

For detailed command reference, see references/command-reference.md.

Common Workflows

Build and Install

# 1. Check environment
python3 $SKILL_DIR/scripts/env_detector.py

# 2. Build the application
python3 $SKILL_DIR/scripts/build.py

# 3. Install to device (output from build.py shows HAP path)
python3 $SKILL_DIR/scripts/install.py -f entry/build/default/outputs/default/entry-default-signed.hap

# 4. Launch the app
python3 $SKILL_DIR/scripts/launch.py

One-line Build, Install, Launch

python3 $SKILL_DIR/scripts/build.py && \
python3 $SKILL_DIR/scripts/install.py -f $(find entry/build -name "*.hap" | head -1) && \
python3 $SKILL_DIR/scripts/launch.py

Debug Workflow

# Launch app
python3 $SKILL_DIR/scripts/launch.py

# Take screenshot to verify
python3 $SKILL_DIR/scripts/screenshot.py -o ./screenshots

Crash Analysis

# Parse crash stack from file
python3 $SKILL_DIR/scripts/parse_crash.py -f crash.txt

# Parse from string
python3 $SKILL_DIR/scripts/parse_crash.py -c "stack trace here"

How It Works

Automatic Environment Detection

All scripts automatically detect DevEco Studio installation and configure the environment:

  1. DevEco Studio Detection
  1. Toolchain Configuration
  1. Auto-Detected Tools

Response Guidelines

When helping users with OHOS development:

  1. Locate Skill Directory
  1. Execute Scripts
  1. Show Environment First
  1. Provide One-liners
  1. Show Actual Commands
  1. Handle Errors Gracefully
  1. Use Project Context

Error Handling

If DevEco Studio is not detected:

If device is not connected:

For detailed troubleshooting, see references/troubleshooting.md.

Prerequisites

Download DevEco Studio: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-download

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.