1# app.json5 Configuration File 2 3## Configuration File Example 4 5 6This topic gives an overview of the **app.json5** configuration file. To start with, let's go through an example of what this file contains. 7 8```json 9{ 10 "app": { 11 "bundleName": "com.application.myapplication", 12 "vendor": "example", 13 "versionCode": 1000000, 14 "versionName": "1.0.0", 15 "icon": "$media:layered-image", 16 "label": "$string:app_name", 17 "description": "$string:description_application", 18 "minAPIVersion": 9, 19 "targetAPIVersion": 9, 20 "apiReleaseType": "Release", 21 "debug": false, 22 "car": { 23 "minAPIVersion": 8 24 }, 25 "targetBundleName": "com.application.test", 26 "targetPriority": 50, 27 "appEnvironments": [ 28 { 29 "name":"name1", 30 "value": "value1" 31 } 32 ], 33 "maxChildProcess": 5, 34 "multiAppMode": { 35 "multiAppModeType": "multiInstance", 36 "maxCount": 5 37 }, 38 "hwasanEnabled": false, 39 "ubsanEnabled": false, 40 "cloudFileSyncEnabled": false, 41 "configuration": "$profile:configuration" 42 }, 43} 44``` 45## Tags in the Configuration File 46 47As shown above, the **app.json5** file contains several tags. 48 49**Table 1** Tags in the app.json5 file 50 51| Name| Description| Data Type| Initial Value Allowed| 52| -------- | -------- | -------- | -------- | 53| bundleName | Bundle name, which uniquely identifies an application. The value must comply with the following rules:<br>- Starts with a letter and consists of letters, digits, underscores (_), and periods (.).<br>- Contains 7 to 128 bytes.<br>You are advised to use the reverse domain name notation, for example, *com.example.demo*, where the first part is the domain suffix **com**, the second part is the vendor/individual name, and the third part is the application name, which can be of multiple levels.<br>If an application is built with the system source code, you are advised to name it in *com.ohos.demo* notation, where **ohos** signifies that the application is a system application.| String| No| 54| bundleType| Bundle type, which is used to distinguish applications and atomic services. The options are as follows:<br>- **app**: The bundle is an application.<br>- **atomicService**: The bundle is an atomic service.<br>- **shared**: The bundle is a shared library. This option is reserved.<br>- **appService**: The bundle is a system-level shared library and can be used only by system applications.| String| Yes (initial value: **app**)| 55| debug | Whether the application can be debugged.<br>- **true**: Can be debugged. Used in the development phase.<br>- **false**: Cannot be debugged. Used in the release phase.| Boolean| Yes (initial value: **false**; it is generated during compilation and building in DevEco Studio.) | 56| [icon](#icon)| [Icon of the application](../application-models/application-component-configuration-stage.md). The value is the index to an icon resource file.| String| No| 57| label | [Name of the application](../application-models/application-component-configuration-stage.md). The value is the index to a string resource. It is a string with a maximum of 63 bytes.| String| No| 58| description | Description of the application. The value is the index to a description. It is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 59| vendor | Vendor of the application. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 60| versionCode | Version code of the application. The value is a positive integer less than 2 to the power of 31. It is used only to determine whether a version is later than another version. A larger value indicates a later version.<br>Ensure that a new version of the application uses a value greater than any of its predecessors.| Number| No| 61| versionName | Version number of the application displayed to users.<br>The value contains a maximum of 127 bytes and consists of only digits and dots. The four-part format *A.B.C.D* is recommended, wherein:<br>Part 1 (*A*): major version number, which ranges from 0 to 99. A major version consists of major new features or large changes.<br>Part 2 (*B*): minor version number, which ranges from 0 to 99. A minor version consists of some new features or large bug fixes.<br>Part 3 (*C*): feature version number, which ranges from 0 to 99. A feature version consists of scheduled new features.<br>Part 4 (*D*): maintenance release number or patch number, which ranges from 0 to 999. A maintenance release or patch consists of resolution to security flaws or minor bugs.| String| No| 62| minCompatibleVersionCode | Minimum compatible version of the application. It is used to check whether the application is compatible with a version on other devices in the cross-device scenario. The value ranges from 0 to 2147483647.| Number| Yes (initial value: value of **versionCode**)| 63| minAPIVersion | Minimum API version required for running the application. The value ranges from 0 to 2147483647.| Number| Yes (initial value: value of **compatibleSdkVersion** in **build-profile.json5**)| 64| targetAPIVersion | Target API version required for running the application. The value ranges from 0 to 2147483647.| Number| Yes (initial value: value of **compileSdkVersion** in **build-profile.json5**)| 65| apiReleaseType | Type of the target API version required for running the application. The value can be **"CanaryN"**, **"BetaN"**, or **"Release"**, where **N** represents a positive integer.<br>- **Canary**: indicates a restricted release.<br>- **Beta**: indicates a publicly released beta version.<br>- **Release**: indicates a publicly released official version.| String| Yes (the value is automatically set by DevEco Studio based on the stage of the SDK in use; a manually set value will be overwritten during compilation and building)| 66| accessible | Whether the installation directory of the application is accessible. This tag is effective only for system applications and pre-installed applications in the stage model.| Boolean| Yes (initial value: **false**)| 67| multiProjects | Whether the application supports joint development of multiple projects.<br>- **true**: The application supports joint development of multiple projects. For details about multi-project development, see <!--RP1-->[Implementing Multi-Project Builds](https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/ide-hvigor-multi-projects-V5)<!--RP1End-->.<br>- **false**: The application does not support joint development of multiple projects.| Boolean| Yes (initial value: **false**)| 68| asanEnabled | Whether to enable AddressSanitizer (ASan) to detect memory corruption issues such as buffer overflows.<br>- **true**: ASan is enabled.<br>- **false**: ASan is disabled.| Boolean| Yes (initial value: **false**)| 69| tablet | Tablet-specific configuration, which includes the **minAPIVersion** attribute.<br>When running on tablets, the application applies the attribute settings under this tag and ignores the general settings in the **app.json5** file.| Object| Yes (initial value: general settings in the **app.json5** file)| 70| tv | TV-specific configuration, which includes the **minAPIVersion** attribute.<br>When running on TVs, the application applies the attribute settings under this tag and ignores the general settings in the **app.json5** file.| Object| Yes (initial value: general settings in the **app.json5** file)| 71| wearable | Wearable-specific configuration, which includes the **minAPIVersion** attribute.<br>When running on wearables, the application applies the attribute settings under this tag and ignores the general settings in the **app.json5** file.| Object| Yes (initial value: general settings in the **app.json5** file)| 72| car | Telematics–specific configuration, which includes the **minAPIVersion** attribute. <br>When running on telematics devices, the application applies the attribute settings under this tag and ignores the general settings in the **app.json5** file.| Object| Yes (initial value: general settings in the **app.json5** file)| 73| default | Default device–specific configuration, which includes the **minAPIVersion** attribute.<br>When running on default devices, the application applies the attribute settings under this tag and ignores the general settings in the **app.json5** file.| Object| Yes (initial value: general settings in the **app.json5** file)| 74|targetBundleName|Target bundle name. The value rule and range are the same as those of **bundleName**. When a value is specified, the target application becomes one with the overlay feature.|String|Yes (initial value: left empty)| 75|targetPriority|Priority of the application. The value ranges from 1 to 100. This tag can be configured only when **targetBundleName** is configured.|Number|Yes (initial value: **1**)| 76|generateBuildHash |Whether to generate hash values for all HAP and HSP files of the application by using the packaging tool.<br>If this tag is set to **true**, the packaging tool generates hash values for all HAP and HSP files of the application. The hash values (if any) are used to determine whether the application needs to be updated when the system is updated in OTA mode but the **versionCode** value of the application remains unchanged.<br>**NOTE**<br>This tag applies only to system applications.|Boolean|Yes (initial value: **false**)| 77| GWPAsanEnabled | Whether to enable GWP-ASan to detect memory safety errors, such as use-after-free and out-of-bounds memory read/write.<br>- **true**: GWP-ASan is enabled.<br>- **false**: GWP-ASan is disabled.| Boolean| Yes (initial value: **false**)| 78| [appEnvironments](#appenvironments) | Application environment variables configured for the current module.| Object array| Yes (initial value: left empty)| 79| maxChildProcess | Maximum number of child processes that can be created by the current application. The value ranges from 0 to 512. The value **0** indicates that the number is not limited. If the application has multiple modules, use the configuration of the **entry** module.| Number| Yes (initial value: preconfigured value)| 80| [multiAppMode](#multiappmode)| Multi-app mode of the application. This tag takes effect only for the entry or feature module of the application whose **bundleType** is **app**. If there are multiple modules, use the configuration of the **entry** module.| Object| Yes (initial value: left empty)| 81| hwasanEnabled | Whether HWAsan detection is enabled for an application. HardWare-assisted AddressSanitizer (HWAsan) is an enhanced Asan improved by the Top-Byte-Ignore feature. Compared with Asan, HWAsan has a lower memory overhead and a larger range of detection for memory errors.<br>- **true**: HWAsan is enabled.<br>- **false**: HWAsan is disabled.| Boolean| Yes (initial value: **false**)| 82| ubsanEnabled | Whether UBsan detection is enabled for an application.<br>Undefined Behavior Sanitizer (UBsan) is a tool used to detect undefined behavior in applications during runtime. It aims to help you detect potential errors and vulnerabilities in code.<br>- **true**: UBsan is enabled.<br>- **false**: UBsan is disabled.| Boolean| Yes (initial value: **false**)| 83| cloudFileSyncEnabled | Whether device-cloud file synchronization is enabled for the application.<br>- **true**: The device-cloud file synchronization is enabled.<br>- **false**: The device-cloud file synchronization is disabled.| Boolean| Yes (initial value: **false**) | 84| [configuration](#configuration)| Whether the font size of the current application follows the system.<br>This tag is a **profile** file resource that used to specify the configuration file that describes the application font size changes with the system.| String| Yes (initial value: by default)| 85 86## icon 87 88The **icon** tag represents the [application icons](../application-models/application-component-configuration-stage.md) and the index to the layered icon configuration files. 89 90Layered icons can be configured as follows: 91 921. Place the foreground and background resources of the icon in the **AppScope/resources/base/media** directory. 93 942. Create a JSON file (for example, **layered-image.json**) in the **media** directory and reference the foreground and background resources in the file. For details, see [Icon Resource Specifications](https://developer.huawei.com/consumer/en/doc/design-guides/application-icon-0000001953444009#section634668113212). 95 96Example of the layered icon resource file: 97 98```json 99{ 100 "layered-image": 101 { 102 "background":"$media:background," // Background resource 103 "foreground":"$media:foreground" // Foreground resource 104 } 105} 106``` 107 108Example of the **icon** structure: 109 110```json 111{ 112 "app":{ 113 "icon":"$media:layered-image" 114 } 115} 116``` 117 118## appEnvironments 119 120The **appEnvironments** tag represents the application environment variables. 121 122**Table 2** appEnvironments 123 124| Name| Description| Data Type| Initial Value Allowed| 125| -------- | -------- | -------- | -------- | 126| name | Name of the environment variable. The value is a string with a maximum of 4096 bytes.| String | Yes (initial value: left empty)| 127| value | Value of the environment variable. The value is a string with a maximum of 4096 bytes. | String | Yes (initial value: left empty)| 128 129Example of the **appEnvironments** structure: 130 131```json 132{ 133 "app": { 134 "appEnvironments": [ 135 { 136 "name":"name1", 137 "value": "value1" 138 } 139 ] 140 } 141} 142``` 143 144## multiAppMode 145 146The **multiAppMode** tag represents the multi-app mode of the application. 147 148**Table 3** multiAppMode 149 150| Name| Description| Data Type| Initial Value Allowed| 151| -------- | -------- | -------- | -------- | 152| multiAppModeType | Multi-open mode. The options are as follows:<br>- **multiInstance**: multi-instance mode. Only 2-in-1 devices are supported. A resident process does not support this value.<br>- **appClone**: app clone mode.| String | No| 153| maxCount | Maximum number of applications that can be opened. The options are as follows:<br>- In **multiInstance** mode, the value ranges from 1 to 10.<br>- In **appClone** mode, the value ranges from 1 to 5. | Number | No| 154 155Example of the **multiAppMode** structure: 156 157```json 158{ 159 "app": { 160 "multiAppMode": { 161 "multiAppModeType": "appClone", 162 "maxCount": 5 163 } 164 } 165} 166``` 167 168## configuration 169 170This tag is a **profile** file resource that used to specify the configuration file that describes the application font size changes with the system. 171 172Example of the **configuration** structure: 173 174```json 175{ 176 "app": { 177 "configuration": "$profile:configuration" 178 } 179} 180``` 181 182Define the **configuration.json** file under **resources/base/profile** in the development view. The file name (**configuration** in this example) can be customized, but must be consistent with the information specified by the **configuration** tag. The file lists the attributes that enable the application font size to change with the system. 183 184**Table 4** configuration 185 186| Name| Description| Data Type| Initial Value Allowed| 187| -------- | -------- | -------- | -------- | 188| fontSizeScale | Settings of the application font size. The options are as follows:<br>- followSystem: The font size follows the system.<br>- FollowSystem: The font size does not follow the system.| String| Yes (initial value: **followSystem**)| 189| fontSizeMaxScale | Maximum ratio of the application font size after the font size is set to follow the system. The options are as follows: 1, 1.15, 1.3, 1.45, 1.75, 2, and 3.2. <br> If **fontSizeScale** is set to **nonFollowSystem**, this attribute does not take effect.| String| Yes (initial value: **3.2**)| 190 191resources/base/profile/configuration.json 192 193```json 194{ 195 "configuration": { 196 "fontSizeScale": "followSystem", 197 "fontSizeMaxScale": "3.2" 198 } 199} 200``` 201