1e41f4b71Sopenharmony_ci# App Check Tool 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## Overview 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciThe 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: 6e41f4b71Sopenharmony_ci- Scans for duplicate files. 7e41f4b71Sopenharmony_ci- Scans for large files (files that exceed the specified size). 8e41f4b71Sopenharmony_ci- Collects statistics on the size and proportion of each type of file. 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ciBy default, the tool generates detection reports in JSON and HTML format. 11e41f4b71Sopenharmony_ciThe **app_check_tool.jar** package of the tool is stored in the **toolchains** directory of the SDK. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## Constraints 16e41f4b71Sopenharmony_ciThe app check tool must run in Java 8 or later. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci## Scanning for Duplicate Files 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci**Command example** 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci``` 23e41f4b71Sopenharmony_cijava -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-duplicate true 24e41f4b71Sopenharmony_ci``` 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci**Parameters of the command** 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci| Parameter | Mandatory| Description | 29e41f4b71Sopenharmony_ci| ---------------- | ---------- | ------------------------------------------------------------------ | 30e41f4b71Sopenharmony_ci| --input | Yes | Path of the HAP, HSP, or APP file. | 31e41f4b71Sopenharmony_ci| --out-path | Yes | Path of the detection reports. | 32e41f4b71Sopenharmony_ci| --stat-duplicate | No | Whether to scan for duplicate files. The default value is **false**.<br>- **true**: Scanning is enabled.<br>- **false**: Scanning is disabled. | 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci**Detection report in JSON format** 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci``` 37e41f4b71Sopenharmony_ci[{ 38e41f4b71Sopenharmony_ci "taskType":1, 39e41f4b71Sopenharmony_ci "taskDesc":"find the duplicated files", 40e41f4b71Sopenharmony_ci "param":"--stat-duplicate", 41e41f4b71Sopenharmony_ci "startTime":"2023-11-17 14:48:01:265", 42e41f4b71Sopenharmony_ci "stopTime":"2023-11-17 14:48:01:434", 43e41f4b71Sopenharmony_ci "result":[{ 44e41f4b71Sopenharmony_ci "md5":"975c41f5727b416b1ffefa5bb0f073b", 45e41f4b71Sopenharmony_ci "size":1108880, 46e41f4b71Sopenharmony_ci "files":[ 47e41f4b71Sopenharmony_ci "/application-entry-default.hap/libs/armeabi-v7a/example.so", 48e41f4b71Sopenharmony_ci "/entry-default.hap/libs/armeabi-v7a/example.so" 49e41f4b71Sopenharmony_ci ] 50e41f4b71Sopenharmony_ci }] 51e41f4b71Sopenharmony_ci}] 52e41f4b71Sopenharmony_ci``` 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci**Fields of the output** 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci| Field | Type | Description | 57e41f4b71Sopenharmony_ci| --------- | ------ | --------------------------- | 58e41f4b71Sopenharmony_ci| taskType | int | Type of the task. The value **1** means a task for scanning for duplicate files.| 59e41f4b71Sopenharmony_ci| taskDesc | String | Description of the task. | 60e41f4b71Sopenharmony_ci| param | String | Parameter passed in by the scanning program. | 61e41f4b71Sopenharmony_ci| startTime | String | Start time of the task. | 62e41f4b71Sopenharmony_ci| stopTime | String | End time of the task. | 63e41f4b71Sopenharmony_ci| result | Struct | [Fields of result](#section1). | 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci**Fields of result**<a name="section1"></a> 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci| Field | Type | Description | 68e41f4b71Sopenharmony_ci| ----- | --------------- | -------------------------- | 69e41f4b71Sopenharmony_ci| md5 | String | MD5 value of the duplicate files. | 70e41f4b71Sopenharmony_ci| size | int | Size of the duplicate files, in bytes.| 71e41f4b71Sopenharmony_ci| files | Vector\<String> | Paths of the duplicate files. | 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci## Scanning for Large Files 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci**Command example** 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci``` 78e41f4b71Sopenharmony_cijava -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-file-size 4 79e41f4b71Sopenharmony_ci``` 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci**Parameters of the command** 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci| Parameter | Mandatory| Description | 84e41f4b71Sopenharmony_ci| ---------------- | ---------- | ----------------------------------------------------------- | 85e41f4b71Sopenharmony_ci| --input | Yes | Path of the HAP, HSP, or APP file. | 86e41f4b71Sopenharmony_ci| --out-path | Yes | Path of the detection reports. | 87e41f4b71Sopenharmony_ci| --stat-file-size | No | File size, in KB. A file with the size larger than this value is treated as a large file.<br>The value ranges from 0 to 4294967295, in KB.| 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci**Detection report in JSON format** 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ci``` 92e41f4b71Sopenharmony_ci[{ 93e41f4b71Sopenharmony_ci "taskType":2, 94e41f4b71Sopenharmony_ci "taskDesc":"find files whose size exceed the limit size", 95e41f4b71Sopenharmony_ci "param":"--stat-file-size 4", 96e41f4b71Sopenharmony_ci "startTime":"2023-11-17 14:48:01:458", 97e41f4b71Sopenharmony_ci "stopTime":"2023-11-17 14:48:01:491", 98e41f4b71Sopenharmony_ci "result":[{ 99e41f4b71Sopenharmony_ci "file":"/application-entry-default.hap/libs/x86_64/example.so", 100e41f4b71Sopenharmony_ci "size":1292840 101e41f4b71Sopenharmony_ci }] 102e41f4b71Sopenharmony_ci}] 103e41f4b71Sopenharmony_ci``` 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci**Fields of the output** 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci| Field | Type | Description | 109e41f4b71Sopenharmony_ci| --------- | ------ | ----------------------------------- | 110e41f4b71Sopenharmony_ci| taskType | int | Type of the task. The value **2** means a task for scanning for large files.| 111e41f4b71Sopenharmony_ci| taskDesc | String | Description of the task. | 112e41f4b71Sopenharmony_ci| param | String | Parameter passed in by the scanning program. | 113e41f4b71Sopenharmony_ci| startTime | String | Start time of the task. | 114e41f4b71Sopenharmony_ci| stopTime | String | End time of the task. | 115e41f4b71Sopenharmony_ci| result | Struct | [Fields of result](#section2). | 116e41f4b71Sopenharmony_ci 117e41f4b71Sopenharmony_ci**Fields of result**<a name="section2"></a> 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci| Field| Type | Description | 120e41f4b71Sopenharmony_ci| ---- | ------ | ------------------------------------ | 121e41f4b71Sopenharmony_ci| file | String | Path of a file. | 122e41f4b71Sopenharmony_ci| size | int | Size of the file, in bytes.| 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ci## Collecting Statistics on the Size and Proportion by File Type 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ci**Command example** 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci``` 129e41f4b71Sopenharmony_cijava -jar app_check_tool.jar --input ./test.app --out-path ./test --stat-suffix true 130e41f4b71Sopenharmony_ci``` 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**Parameters of the command** 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci| Parameter | Mandatory| Description | 135e41f4b71Sopenharmony_ci| ------------- | ---------- | ------------------------------------------------------------------------- | 136e41f4b71Sopenharmony_ci| --input | Yes | Path of the HAP, HSP, or APP file. | 137e41f4b71Sopenharmony_ci| --out-path | Yes | Path of the detection reports. | 138e41f4b71Sopenharmony_ci| --stat-suffix | No | Whether to collect statistics on the size and proportion of each type of file. The default value is **false**.<br>- **true**: Statistics collection is enabled.<br>- **false**: Statistics collection is disabled.| 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci**Detection report in JSON format** 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ci``` 143e41f4b71Sopenharmony_ci[{ 144e41f4b71Sopenharmony_ci "taskType":3, 145e41f4b71Sopenharmony_ci "taskDesc":"show files group by file type[.suffix]", 146e41f4b71Sopenharmony_ci "param":"--stat-suffix", 147e41f4b71Sopenharmony_ci "startTime":"2023-11-17 14:48:01:497", 148e41f4b71Sopenharmony_ci "stopTime":"2023-11-17 14:48:01:537", 149e41f4b71Sopenharmony_ci "pathList":[ 150e41f4b71Sopenharmony_ci "test.app/application-entry-default.hap", 151e41f4b71Sopenharmony_ci "test.app/entry-default.hap" 152e41f4b71Sopenharmony_ci ], 153e41f4b71Sopenharmony_ci "result":[{ 154e41f4b71Sopenharmony_ci "suffix":"so", 155e41f4b71Sopenharmony_ci "totalSize":1292840, 156e41f4b71Sopenharmony_ci "files":[{ 157e41f4b71Sopenharmony_ci "compress":"false", 158e41f4b71Sopenharmony_ci "file":"/application-entry-default.hap/libs/x86_64/example.so", 159e41f4b71Sopenharmony_ci "size":1292840 160e41f4b71Sopenharmony_ci }] 161e41f4b71Sopenharmony_ci }, 162e41f4b71Sopenharmony_ci { 163e41f4b71Sopenharmony_ci "suffix":"abc", 164e41f4b71Sopenharmony_ci "totalSize":84852, 165e41f4b71Sopenharmony_ci "files":[{ 166e41f4b71Sopenharmony_ci "file":"/application-entry-default.hap/ets/modules.abc", 167e41f4b71Sopenharmony_ci "size":76304 168e41f4b71Sopenharmony_ci }, 169e41f4b71Sopenharmony_ci { 170e41f4b71Sopenharmony_ci "file":"/entry-default.hap/ets/modules.abc", 171e41f4b71Sopenharmony_ci "size":8548 172e41f4b71Sopenharmony_ci }] 173e41f4b71Sopenharmony_ci }] 174e41f4b71Sopenharmony_ci}] 175e41f4b71Sopenharmony_ci``` 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci**Fields of the output** 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci| Field | Type | Description | 182e41f4b71Sopenharmony_ci| --------- | --------------- | -------------------------------------------------------------------------------------- | 183e41f4b71Sopenharmony_ci| 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. | 184e41f4b71Sopenharmony_ci| taskDesc | String | Description of the task. | 185e41f4b71Sopenharmony_ci| param | String | Parameter passed in by the scanning program. | 186e41f4b71Sopenharmony_ci| startTime | String | Start time of the task. | 187e41f4b71Sopenharmony_ci| stopTime | String | End time of the task. | 188e41f4b71Sopenharmony_ci| pathList | Vector\<String> | Paths of multiple HAP and HSP files. | 189e41f4b71Sopenharmony_ci| result | Struct | [Fields of result](#section3). | 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci**Fields of result**<a name="section3"></a> 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_ci| Field | Type | Description | 194e41f4b71Sopenharmony_ci| --------- | ------ | ------------------------------------------ | 195e41f4b71Sopenharmony_ci| suffix | String | File name extension. | 196e41f4b71Sopenharmony_ci| totalSize | int | Total size of the files with the same file name extension, in bytes.| 197e41f4b71Sopenharmony_ci| files | Stuct | [Fields of files](#section4). | 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_ci**Fields of files**<a name="section4"></a> 200e41f4b71Sopenharmony_ci| Field | Type | Description | 201e41f4b71Sopenharmony_ci| -------- | ------ | ------------------------------------------------------------------- | 202e41f4b71Sopenharmony_ci| file | String | Path of a file. | 203e41f4b71Sopenharmony_ci| size | int | Size of the file. | 204e41f4b71Sopenharmony_ci| compress | bool | Whether the file is compressed. This field is displayed only for .so files.<br>- **true**: The file is compressed.<br>- **false**: The file is not compressed.| 205