harmony 鸿蒙Internal Structure of the app Tag

  • 2023-02-03
  • 浏览 (651)

Internal Structure of the app Tag

The app tag contains application-wide configuration. The internal structure is as follows:

Table 1 Internal structure of the app tag

Name Description Data Type Initial Value Allowed
bundleName Bundle name, which uniquely identifies an application. The bundle name must start with a letter and can contain only letters, digits, underscores (_), and periods (.). The bundle name is a string with 7 to 128 bytes of a reverse domain name, for example, “com.example.myapplication”. It is recommended that the first level be the domain suffix “com” and the second level be the vendor/individual name. More levels are also accepted. String No
vendor Vendor of the application. The value is a string with a maximum of 255 bytes. String Yes (initial value: left empty)
version Version of the application. Object No
apiVersion OpenHarmony API version on which the application depends. Object Yes (initial value: left empty)
smartWindowSize Screen size used when the application runs in the emulator. String Yes (initial value: left empty)
smartWindowDeviceType Types of emulated devcies on which the application can run. String array Yes (initial value: left empty)
asanEnabled Whether to enable AddressSanitizer (ASan) to detect memory corruption issues such as buffer overflows.
- true: ASan is enabled.
- false: ASan is disabled. Note that ASan is not available in the Release version.
Boolean Yes (initial value: false)

Internal Structure of the version Atttribute

Table 2 Internal structure of the version atttribute

Name Description Data Type Initial Value Allowed
name Application version number displayed to users. The value can be customized and cannot exceed 127 bytes. The configuration rules are as follows:
For API version 5 and earlier versions, use the three-part format A.B.C (compatible with a two-part format A.B), where A, B, and C are integers ranging from 0 to 999.
- A indicates the major version number.
- B indicates the minor version number.
- C indicates the patch version number.
For API version 6 and later versions, the four-part format A.B.C.D is recommended, where A, B, and C are integers ranging from 0 to 99, and D is an integer ranging from 0 to 999.
- A indicates the major version number.
- B indicates the minor version number.
- C indicates the feature version number.
- D indicates the patch version number.
Number No
code Application version number used only for application management by OpenHarmony. This version number is not visible to users of the application. The configuration rules are as follows:
API version 5 and earlier versions: The value is a non-negative integer within 32 binary digits, which needs to be converted from the value of version.name. The conversion rule is as follows: Value of code = A * 1,000,000 + B * 1,000 + C. For example, if the value of version.name is 2.2.1, the value of code is 2002001. API version 6 and later versions: The value of code is not associated with the value of version.name and can be customized. The value is a non-negative integer less than 2 to the power of 31. Note that the value must be updated each time the application version is updated, and the value for a later version must be greater than that for an earlier version.
Number No
minCompatibleVersionCode Earliest version compatible with the application. It is used in the cross-device scenario to check whether the application is compatible with a specific version on other devices. The value rules are the same as those of version.code. Number No (initial value: value of code)

Internal Structure of the apiVersion Attribute

Table 3 Internal structure of the apiVersion attribute

Name Description Data Type Initial Value Allowed
compatible Minimum API version required for running the application. The value ranges from 0 to 2147483647. Number Yes (initial value: configured in build.profile and filled in config.json by DevEco Studio during packaging)
target Target API version required for running the application. The value ranges from 0 to 2147483647. Number Yes (initial value: configured in build.profile and filled in config.json by DevEco Studio during packaging)
releaseType SDK status when the application is running.
canary: preliminary release open only to specific developers. This release does not promise API stability and may require tolerance of instability.
beta: release open to all developers. This release does not promise API stability and may require tolerance of instability. After several releases, the beta version is declared as an API stability milestone through Release Notes, and APIs of later versions are frozen.
release: official release open to all developers. This release promises that all APIs are stable. When a version is in this state, the Stage field is not displayed in the version number.
String Yes (initial value: configured in build.profile and filled in config.json by DevEco Studio during packaging)

Example of the app tag:

"app": {
    "bundleName": "com.example.myapplication",
    "vendor": "example",
    "version": {
      "code": 8,
      "name": "8.0.1"
    },
    "apiVersion": {
      "compatible": 8,
      "target": 9,
      "releaseType": "Beta1"
    }
  }

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Quick Start

harmony 鸿蒙app.json5 Configuration File

harmony 鸿蒙Application Configuration File Overview (FA Model)

harmony 鸿蒙Application Configuration File Overview (Stage Model)

harmony 鸿蒙Application Installation and Uninstallation Process

harmony 鸿蒙Application Package Overview

harmony 鸿蒙Application Package Structure in FA Model

harmony 鸿蒙Application Package Structure in Stage Model

harmony 鸿蒙Application Package Update Process

harmony 鸿蒙\@AnimatableExtend Decorator: Definition of Animatable Attributes

0  赞