We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
GuidesSystemDebugging ToolsDebugging CommandsApp Check Tool

App Check Tool

Overview

The app check tool is used to analyze and detect application installation packages. Based on the parameter settings, it scans the HAP, HSP, or APP file in the specified path and generates detection reports, providing data support for you to optimize the package structure or locate problems. The tool provides the following functions:

  • Scans for duplicate files.
  • Scans for large files (files that exceed the specified size).
  • Collects statistics on the size and proportion of each type of file.

By default, the tool generates detection reports in JSON and HTML format.

The app_check_tool.jar package of the tool is stored in the toolchains directory of the SDK.

Constraints

  • The app check tool must run in Java 8 or later.
  • The directory where the app check tool is running must have the read and write permissions.

Scanning for Duplicate Files

Command example

Collapse
Word wrap
Dark theme
Copy code
  1. java -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-duplicate true

Table 1 Parameters of the command

Expand
Parameter Mandatory Description
--input Yes Path of the HAP, HSP, or APP file.
--out-path Yes Path of the detection reports.
--stat-duplicate No

Whether to scan for duplicate files. The default value is false.

true: Scanning is enabled.

false: Scanning is disabled.

Detection report in JSON format

Collapse
Word wrap
Dark theme
Copy code
  1. [{
  2. "taskType":1,
  3. "taskDesc":"find the duplicated files",
  4. "param":"--stat-duplicate",
  5. "startTime":"2023-11-17 14:48:01:265",
  6. "stopTime":"2023-11-17 14:48:01:434",
  7. "result":[{
  8. "md5":"975c41f5727b416b1ffefa5bb0f073b2",
  9. "size":1108880,
  10. "files":[
  11. "/application-entry-default.hap/libs/armeabi-v7a/example.so",
  12. "/entry-default.hap/libs/armeabi-v7a/example.so"
  13. ]
  14. }]
  15. }]

Table 2 Fields of the output

Expand
Field Type Description
taskType int Type of the task. The value 1 means a task for scanning for duplicate files.
taskDesc String Description of the task.
param String Parameter passed in by the scanning program.
startTime String Start time of the task.
stopTime String End time of the task.
result Struct Duplicate file statistics result. For details, see Table 3.

Table 3 Fields of the result

Expand
Field Type Description
md5 String MD5 value of the duplicate files.
size int Size of the duplicate files, in bytes.
files Vector<String> Paths of the duplicate files.

Scanning for Large Files

Command example

Collapse
Word wrap
Dark theme
Copy code
  1. java -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-file-size 4

Table 4 Parameters of the command

Expand
Parameter Mandatory Description
--input Yes Path of the HAP, HSP, or APP file.
--out-path Yes Path of the detection reports.
--stat-file-size No

File size, in KB. A file with the size larger than this value is treated as a large file.

The value ranges from 0 to 4294967295, in KB.

Detection report in JSON format

Collapse
Word wrap
Dark theme
Copy code
  1. [{
  2. "taskType":2,
  3. "taskDesc":"find files whose size exceed the limit size",
  4. "param":"--stat-file-size 4",
  5. "startTime":"2023-11-17 14:48:01:458",
  6. "stopTime":"2023-11-17 14:48:01:491",
  7. "result":[{
  8. "file":"/application-entry-default.hap/libs/x86_64/example.so",
  9. "size":1292840
  10. }]
  11. }]

Table 5 Fields of the output

Expand
Field Type Description
taskType int Type of the task. The value 2 means a task for scanning for large files.
taskDesc String Description of the task.
param String Parameter passed in by the scanning program.
startTime String Start time of the task.
stopTime String End time of the task.
result Struct Statistics result of files that exceed the specified size. For details, see Table 6.

Table 6 Fields of the result

Expand
Field Type Description
file String Path of a file.
size int Size of the file, in bytes.

Collecting Statistics on the Size and Proportion by File Type

Command example

Collapse
Word wrap
Dark theme
Copy code
  1. java -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-suffix true

Table 7 Parameters of the command

Expand
Parameter Mandatory Description
--input Yes Path of the HAP, HSP, or APP file.
--out-path Yes Path of the detection reports.
--stat-suffix No

Whether to collect statistics on the size and proportion of each type of file. The default value is false.

true: Scanning is enabled.

false: Scanning is disabled.

Detection report in JSON format

Collapse
Word wrap
Dark theme
Copy code
  1. [{
  2. "taskType":3,
  3. "taskDesc":"show files group by file type[.suffix]",
  4. "param":"--stat-suffix",
  5. "startTime":"2023-11-17 14:48:01:497",
  6. "stopTime":"2023-11-17 14:48:01:537",
  7. "pathList":[
  8. "test.app/application-entry-default.hap",
  9. "test.app/entry-default.hap"
  10. ],
  11. "result":[{
  12. "suffix":"so",
  13. "totalSize":1292840,
  14. "files":[{
  15. "compress":"false",
  16. "file":"/application-entry-default.hap/libs/x86_64/example.so",
  17. "size":1292840
  18. }]
  19. },
  20. {
  21. "suffix":"abc",
  22. "totalSize":84852,
  23. "files":[{
  24. "file":"/application-entry-default.hap/ets/modules.abc",
  25. "size":76304
  26. },
  27. {
  28. "file":"/entry-default.hap/ets/modules.abc",
  29. "size":8548
  30. }]
  31. }]
  32. }]

Table 8 Fields of the output

Expand
Field Type Description
taskType int Type of the task. The value 3 means a task for collecting statistics on the size and proportion of each type of file.
taskDesc String Description of the task.
param String Parameter passed in by the scanning program.
startTime String Start time of the task.
stopTime String End time of the task.
pathList Vector<String> Paths of multiple HAP and HSP files.
result Struct Statistics result of the file size proportion of each type. For details, see Table 9.

Table 9 Fields of the result

Expand
Field Type Description
suffix String File name extension.
totalSize int Total size of scanned files of the same type, in bytes.
files Struct Path and size of files of the same type. For details, see Table 10.

Table 10 Fields of the Struct

Expand
Field Type Description
file String Path of a file.
size int File size, in bytes.
compress bool

Whether the file is compressed. This field is displayed only for .so files.

true: The file is compressed.

false: The file is not compressed.

Search in Guides
Enter a keyword.