每個應用項目必須在項目的代碼目錄下加入配置文件,這些配置文件會向HarmonyOS的編譯工具、HarmonyOS操作系統(tǒng)和應用市場提供描述應用的基本信息。
應用配置文件需申明以下內(nèi)容:
應用的軟件包名稱,應用的開發(fā)廠商,版本號等應用的基本配置信息,這些信息被要求設(shè)置在app這個字段下。
應用的組件的基本信息,包括所有的Ability,設(shè)備類型,組件的類型以及當前組件所使用的語法類型。
應用在具體設(shè)備上的配置信息,這些信息會影響應用在設(shè)備上的具體功能。
在FA模型的應用開發(fā)過程中,需要在config.json配置文件中對應用的包結(jié)構(gòu)進行聲明。
config.json示例:
{
"app": {
"vendor": "example",
"bundleName": "com.example.demo",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
},
"module": {
"mainAbility": ".MainAbility_entry",
"deviceType": [
"tablet"
],
"commonEvents": [
{
"name": ".MainAbility",
"permission": "ohos.permission.GET_BUNDLE_INFO",
"data": [
"com.example.demo",
"100"
],
"events": [
"install",
"update"
]
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility_entry",
"name": ".MainAbility_entry",
"srcLanguage": "ets",
"icon": "$media:icon",
// $string:MainAbility_entry_desc為資源索引
"description": "$string:MainAbility_entry_desc",
"formsEnabled": false,
// $string:MainAbility_entry_label為資源索引
"label": "$string:MainAbility_entry_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "myapplication"
},
"package": "com.example.myapplication",
"srcPath": "",
"name": ".myapplication",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility_entry",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}