docs/collocation/manifest.md
manifest.json 是 uni-app x 项目的配置文件,用于设置应用的名称、版本、图标等信息。在 HBuilderX 中创建项目时此文件保存在根目录。
uni-app x 默认没有splash启动界面,因uni-app x打包后启动速度非常快,可以自己做一个简单的uvue页面来当做splash。HBuilderX3.99+版本新增支持配置splash启动界面,详情参考启动界面配置。
uni-app x 目前不提供内置模块选择,而是提供了摇树机制自动选择内置模块,详情参考模块配置。
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appid | string | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | DCloud AppID 使用说明 |
| name | string | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 应用名称 |
| description | string | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 应用描述 |
| versionName | string | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 应用版本名称 |
| versionCode | integer | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 应用版本号,必须是整数,取值范围1~2147483647;升级时必须高于上一次设置的值。 |
| locale | '' | - | Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 默认语言 |
| fallbackLocale | '' | - | Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 默认回退语言 |
| uni-app-x | uni-app-x 配置项列表 | - | Web: 4.0; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 存在uni-app-x节点则表示为uni-app x项目 |
| app | app 配置项列表 | - | Web: x; 微信小程序: -; Android: 3.9; iOS: 4.11; HarmonyOS: -; HarmonyOS(Vapor): - | App平台(原生App)配置 |
| app-android | app-android 配置项列表 | - | Web: -; 微信小程序: -; Android: 4.71; iOS: -; HarmonyOS: -; HarmonyOS(Vapor): - | App-Android平台配置 |
| app-ios | app-ios 配置项列表 | - | Web: -; 微信小程序: -; Android: -; iOS: 4.71; HarmonyOS: -; HarmonyOS(Vapor): - | iOS App平台配置 |
| app-harmony | app-harmony 配置项列表 | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | HarmonyOS平台配置 |
| web | web 配置项列表 | - | Web: 4.0; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | Web平台配置 |
| mp-weixin | mp-weixin 配置项列表 | - | - | - |
| __hbuilderx | __hbuilderx 配置项列表 | - | Web: x; 微信小程序: -; Android: 4.31; iOS: 4.31; HarmonyOS: -; HarmonyOS(Vapor): - | 用于HBuilderX可视化界面相关操作配置 |
注意
appid 由 DCloud 云端分配,主要用于 DCloud 相关的云服务,请勿自行修改。详见uni-app-x 节点必须存在,它是一个项目是否是 uni-app x项目的核心标识。
存在uni-app-x节点则表示为uni-app x项目
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| flex-direction | 'row' | 'row-reverse' | 'column' | 'column-reverse' | "column" | - | uvue页面默认flex排列方向 |
App平台(原生App)配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| defaultAppTheme | 'auto' | 'light' | 'dark' | "light" | Web: -; 微信小程序: -; Android: 4.18; iOS: 4.18; HarmonyOS: -; HarmonyOS(Vapor): - | 应用默认主题,可取值 light/dark/auto,默认值为 light。应用主题适配参考文档 |
| distribute | distribute 配置项列表 | - | - | App平台发布配置 |
| initPrivacyAuthorization | 'auto' | 'agree' | 'disagree' | "auto" | Web: -; 微信小程序: -; Android: 4.31; iOS: 4.31; HarmonyOS: x; HarmonyOS(Vapor): - | 隐私协议初始状态,可取值 auto/agree/disagree,默认值为 auto。获取应用隐私协议状态相关api参考文档 |
uni-app 项目可配置原生的隐私弹框。这是因为开发者的js执行较慢,在原生代码获取隐私前来不及弹框,不能满足先弹隐私政策后采集数据的合规要求。
但uni-app x 项目是原生驱动执行的,开发者的代码执行非常快,无需再提供隐私政策弹框配置。自行弹框即可。
但开发者需注意在用户同意隐私政策前,不要采集涉及隐私的数据。如果违反当地法律或应用商店的要求,会无法上架应用商店甚至被处罚。
hello uni-app x中提供了基于dialogPage的隐私政策弹框示例代码,在app.uvue的代码中搜索uni.getPrivacySetting可见,详见
该示例代码在应用启动的onLauch中,判断隐私协议是否已经被同意,未同意的话通过dialogPage弹出一个页面,该页面有隐私协议的内容及同意、取消按钮。
其中同意按钮为button组件的open-type=agreePrivacyAuthorization
App平台发布配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| syncDebug | boolean | "false" | - | 是否为自定义调试基座 |
| icons | icons 配置项列表 | - | - | Android、iOS平台应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。 |
| splashScreens | splashScreens 配置项列表 | - | - | Android、iOS平台应用启动界面配置。云端打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作 参考文档 |
| android | android 配置项列表 | - | - | App-Android平台发布配置 |
| ios | ios 配置项列表 | - | - | IOS配置 |
| modules | modules 配置项列表 | - | - | app内置模块配置 |
iOS平台应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appstore | string | - | - | iPhone/iPad设备应用图标,分辨率要求 1024x1024 |
注意
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| hdpi | string | - | - | 高分屏设备应用图标,分辨率要求72x72 |
| xhdpi | string | - | - | 720P高分屏设备应用图标,分辨率要求96x96 |
| xxhdpi | string | - | - | 1080P高分屏设备应用图标,分辨率要求144x144 |
| xxxhdpi | string | - | - | 2K屏设备应用图标,分辨率要求192x192 |
必须使用
png格式图标
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appstore | string | - | - | iPhone/iPad设备应用图标,分辨率要求 1024x1024 |
<!-- MANIFESTJSON.icons_ios.compatibility -->必须使用
png格式图标,图片中不能存在透明区域
iOS平台应用启动界面配置。云端打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,参考文档
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| ldpi | string | - | - | 适用于(mdpi)密度屏幕(~120dpi),建议分辨率 240x320。此类设备不常见,通常可以不用配置此项。 |
| mdpi | string | - | - | 适用于(mdpi)密度屏幕(~160dpi),建议分辨率 320x480。此类设备不常见,通常可以不用配置此项。 |
| hdpi | string | - | - | 适用于(hdpi)密度屏幕(~240dpi),建议分辨率 480x800。此类设备不常见,通常可以不用配置此项。 |
| xhdpi | string | - | - | 适用于(xhdpi)密度屏幕(~320dpi),建议分辨率 720x1280 |
| xxhdpi | string | - | - | 适用于(xxhdpi)密度屏幕(~480dpi),建议分辨率 1080x1920 |
| xxxhdpi | string | - | - | 适用于(xxxhdpi)密度屏幕(~640dpi),建议分辨率 2160x3840 |
适配支持Android12启动界面。无此配置项表示不适配支持Android12启动界面。
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| background | string | - | - | 仅在Android12及以上设备生效,默认值为白色 |
| icon | icon 配置项列表 | - | - | Android12启动界面中部Logo图标 |
| brand | brand 配置项列表 | - | - | Android12启动界面底部品牌图标 |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| xhdpi | string | - | - | 适用于(xhdpi)密度屏幕(~320dpi),建议分辨率 480x480 |
| xxhdpi | string | - | - | 适用于(xxhdpi)密度屏幕(~480dpi),建议分辨率 720x720 |
| xxxhdpi | string | - | - | 适用于(xxxhdpi)密度屏幕(~640dpi),建议分辨率 960x960 |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| xhdpi | string | - | - | 适用于(xhdpi)密度屏幕(~320dpi),建议分辨率 400x160 |
| xxhdpi | string | - | - | 适用于(xxhdpi)密度屏幕(~480dpi),建议分辨率 600x240 |
| xxxhdpi | string | - | - | 适用于(xxxhdpi)密度屏幕(~640dpi),建议分辨率 800x320 |
App-Android平台发布配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| permissions | Array<string> | - | Web: -; 微信小程序: -; Android: 4.53; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 额外添加的权限 参考文档 |
| excludePermissions | Array<string> | - | Web: -; 微信小程序: -; Android: 4.53; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 强制移除的权限 参考文档 |
| minSdkVersion | integer | 21 | Web: -; 微信小程序: -; Android: 3.9; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 应用兼容的最低Android版本(API等级) 参考文档 |
| targetSdkVersion | integer | 32 | Web: -; 微信小程序: -; Android: 3.9; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 应用适配的目标Android版本(API等级),部分应用市场要求设置较高的targetSdkVersion才能提交审核 参考文档 |
| abiFilters | Array<'armeabi-v7a' | 'arm64-v8a' | 'x86' | 'x86_64'> | ["arm64-v8a"] | Web: -; 微信小程序: -; Android: 3.9; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 应用支持的CPU类型 参考文档 |
| enableResourceOptimizations | boolean | "true" | Web: -; 微信小程序: -; Android: 4.33; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 是否开启Android原生res资源文件优化,开启后res资源文件名称会被混淆 参考文档 |
| aaptOptions | Array<string> | - | Web: -; 微信小程序: -; Android: 4.31; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | aaptOptions 配置项 参考文档 |
| buildFeatures | Array<string> | - | Web: -; 微信小程序: -; Android: 4.31; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | buildFeatures 配置项 参考文档 |
| packagingOptions | Array<string> | - | Web: -; 微信小程序: -; Android: 4.27; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | packagingOptions 配置项 参考文档 |
manifest.json中不提供配置 manifestPlaceholders 数据,如果应用使用的插件或三方SDK需要使用,可在项目的 nativeResources/android/manifestPlaceholders.json 文件中配置,详情参考Android原生应用清单文件和资源。
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| devices | 'iphone' | 'ipad' | 'universal' | "auto" | Web: -; 微信小程序: -; Android: x; iOS: 4.11; HarmonyOS: -; HarmonyOS(Vapor): - | iOS支持的设备 |
| CFBundleName | string | "UniAppX" | Web: -; 微信小程序: -; Android: x; iOS: 4.34; HarmonyOS: -; HarmonyOS(Vapor): - | 应用内部名称(可作为开发者标识),最多可使用15个字符,详情参考 |
| UIRequiresFullScreen | boolean | "false" | Web: -; 微信小程序: -; Android: x; iOS: 4.34; HarmonyOS: -; HarmonyOS(Vapor): - | 在iPad设备是否全屏显示,设置为false表示应用能够与其他应用共享屏幕显示(分屏显示) 详情参考 |
HarmonyOS分发模块配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| uni-location-system | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 系统定位模块 |
| uni-map-tencent | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 腾讯地图模块 |
| uni-oauth | uni-oauth 配置项列表 | - | - | 华为OAuth模块 |
| uni-share | uni-share 配置项列表 | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.75; HarmonyOS(Vapor): - | share 模块 |
| uni-payment-alipay | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 支付宝支付模块 |
| uni-payment-wxpay | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 微信支付模块 |
| uni-push | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 统一推送模块 |
| uni-verify | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | 一键登录模块 |
| uni-facialVerify | object | - | Web: -; 微信小程序: -; Android: -; iOS: -; HarmonyOS: 4.61; HarmonyOS(Vapor): - | uni实人认证模块 |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| gdt | object | - | - | 腾讯优量汇广告联盟 |
| gm | object | - | - | 穿山甲GroMore |
| ks | object | - | - | 快手广告联盟 |
| sgm | object | - | - | Sigmob广告联盟 |
| bd | object | - | - | 百度百青藤广告联盟 |
iOS平台uni-payment(支付)模块Provider配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| alipay | object | - | - | 支付宝支付 |
| wxpay | wxpay 配置项列表 | - | - | 微信支付 |
微信支付
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appid | string | - | - | 微信开放平台创建移动应用时获取的APPID,以wx开头的字符串 |
| universalLink | string | - | - | 微信开放平台的应用开发配置中设置的 Universal Links 值 |
ios平台微信支付配置信息
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appid | string | - | - | 微信开放平台申请的应用ID(AppID) |
| universalLink | string | - | - | 通用链接(Universal Link),配置方式参考:iOS通用链接 |
Web平台配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| title | string | - | - | 默认为应用名称 |
| template | string | - | - | 默认为空可定制生成的html代码,参考:https://uniapp.dcloud.net.cn/collocation/manifest.html#h5-template |
| router | router 配置项列表 | - | - | - |
| devServer | devServer 配置项列表 | - | - | - |
| optimization | optimization 配置项列表 | - | - | - |
| unipush | unipush 配置项列表 | - | - | - |
| sdkConfigs | sdkConfigs 配置项列表 | - | - | - |
| darkmode | boolean | - | - | 是否开启暗黑模式 |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| mode | 'hash' | 'history' | - | - | hash |
| base | string | - | - | 例:/web/,代表在域名的/web/目录下部署运行。如设为./,则代表相对路径,支持file协议打开,此时路由模式强制为hash模式。 |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| port | integer | - | - | 参考:https://uniapp.dcloud.net.cn/collocation/manifest.html#devserver |
| https | boolean | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| treeShaking | treeShaking 配置项列表 | - | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| enable | boolean | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| enable | boolean | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| maps | maps 配置项列表 | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| tencent | tencent 配置项列表 | - | - | |
| google 配置项列表 | - | - | ||
| amap | amap 配置项列表 | - | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| key | string | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| key | string | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| key | string | - | - | |
| securityJsCode | string | - | - | |
| serviceHost | string | - | - |
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| appid | string | - | - | 微信小程序的AppID,登录 https://mp.weixin.qq.com 申请 |
| setting | object | - | - | 微信小程序项目设置,参考 https://uniapp.dcloud.net.cn/collocation/manifest?id=setting |
| functionalPages | boolean | - | - | 微信小程序是否启用插件功能页,默认关闭 |
| requiredBackgroundModes | array | - | - | 微信小程序需要在后台使用的能力,详见 https://developers.weixin.qq.com/miniprogram/dev/framework/config.html#requiredbackgroundmodes |
| plugins | object | - | - | 使用到的插件,详见 https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html |
| resizable | boolean | - | - | 在iPad上小程序是否支持屏幕旋转,默认关闭 |
| navigateToMiniProgramAppIdList | array | - | - | 需要跳转的小程序列表,详见 https://developers.weixin.qq.com/minigame/dev/reference/configuration/app.html#navigateToMiniProgramAppIdList |
| permission | object | - | - | 微信小程序接口权限相关设置,比如申请位置权限必须填此处详见 https://developers.weixin.qq.com/miniprogram/dev/framework/config.html |
| workers | string | - | - | Worker 代码放置的目录。 详见 https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html |
| optimization | object | - | - | 对微信小程序的优化配置 |
| cloudfunctionRoot | string | - | - | 配置云开发目录,参考 https://uniapp.dcloud.net.cn/collocation/manifest?id=cloudfunctionRoot |
| scopedSlotsCompiler | string | - | - | Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto |
| mergeVirtualHostAttributes | boolean | - | - | 合并由 Vue 组件编译而成的小程序组件虚拟节点外层属性,目前仅支持 id(v4.42+)、style(v3.5.1+)、class(v3.5.1+)以及 v-show 指令生成的 hidden(v4.41+) 属性 |
| slotMultipleInstance | boolean | - | - | 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持 |
| embeddedAppIdList | array | - | - | 要半屏跳转的小程序appid。详见 https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/openEmbeddedMiniProgram.html |
| requiredPrivateInfos | array | - | - | 地理位置相关接口。详见 https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#requiredPrivateInfos |
| lazyCodeLoading | string | - | - | 目前仅支持值 requiredComponents,代表开启小程序按需注入特性,详见 https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#lazyCodeLoading |
| enableVirtualHost | boolean | - | - | 是否为组件启用virtualHost,默认启用 |
| darkmode | boolean | - | - | 是否开启暗黑模式 |
用于HBuilderX可视化界面相关操作配置
| 属性 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| channel_list | array | - | Web: -; 微信小程序: -; Android: 4.31; iOS: x; HarmonyOS: -; HarmonyOS(Vapor): - | 云端打包时配置的自定义渠道信息 |