openharmony 鸿蒙 app-structure

2023-02-03 浏览 (901)

Structure of the app Tag

The app tag contains application-wide configuration. The following table describes its internal structure.

Table 1 Internal structure of the app tag

NameDescriptionData TypeInitial Value Allowed
bundleNameBundle 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 represented as a reverse domain name of 7 to 128 bytes, 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.
StringNo
vendorVendor of the application. The value is a string with a maximum of 255 bytes.StringYes (initial value: left empty)
versionVersion of the application.ObjectNo
apiVersionOperating system and API version on which the application depends.ObjectYes (initial value: left empty)
smartWindowSizeScreen size used when the application runs in the Emulator.StringYes (initial value: left empty)
smartWindowDeviceTypeTypes of the emulated devices on which the application can run.String arrayYes (initial value: left empty)
asanEnabledWhether to enable AddressSanitizer (ASan) to detect memory corruption issues such as buffer overflows.
- true: ASan is enabled.
- false: ASan is disabled.
BooleanYes (initial value: false)

Internal Structure of the version Attribute

Table 2 Internal structure of the version attribute

NameDescriptionData TypeInitial Value Allowed
nameApplication 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.
NumberNo
codeApplication version number used only for application management by the operating system. It is not visible to end users. The configuration rules are as follows:
API version 5 and earlier versions: The value is a non-negative integer within 32 binary digits, which is 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.
NumberNo
minCompatibleVersionCodeEarliest 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.NumberNo (initial value: value of code)

Internal Structure of the apiVersion Attribute

Table 3 Internal structure of the apiVersion attribute

NameDescriptionData TypeInitial Value Allowed
compatibleMinimum API version required for running the application. The value ranges from 0 to 2147483647.NumberYes (initial value: configured in build.profile and filled in config.json by DevEco Studio during packaging)
targetTarget API version required for running the application. The value ranges from 0 to 2147483647.NumberYes (initial value: configured in build.profile and filled in config.json by DevEco Studio during packaging)
releaseTypeSDK 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, ths stage is not displayed in the version number.
StringYes (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 鸿蒙Creating an Application Clone

harmony 鸿蒙app.json5 Configuration File

harmony 鸿蒙Overview of Application Configuration Files in FA Model

harmony 鸿蒙Overview of Application Configuration Files in Stage Model

harmony 鸿蒙Application Installation, Uninstall, and Update

harmony 鸿蒙Application Package Overview

harmony 鸿蒙Application Package Structure in FA Model

harmony 鸿蒙Application Package Structure in Stage Model

harmony 鸿蒙ArkTS Coding Style Guide

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/2d73d302025642feb717408ee86f46c9