DEV Community

HarmonyOS
HarmonyOS

Posted on

Query Harmony apps and export hap file

Read the original article:Query Harmony apps and export hap file

Question:

How can I export the hap package from the test device to my local machine when encountering the "Error opening file: permission denied"?

Short Answer:

The test device is not rooted. To resolve this, find the root package of the corresponding ROM version, root the device, and then try exporting the hap package again.

Applicable Scenarios:

  • When attempting to export a hap package from a test device that is not rooted and receiving a "permission denied" error.
  • When working with non-rooted test devices and needing to access system-level files for testing or export purposes.

1- Query the application package name: hdc shell aa dump -l

2- Query the hap package path:
hdc shell

$ bm dump -n bundlename | grep hapPath

command to view the hap package path, where bundlename is the one queried in step 1

3- Export the package to the local computer: The prerequisite is to exit the shell mode first

$ exit
hdc file recv path D:\temp, the path is obtained in step 2

Written by Merve Yonetci

Top comments (0)