【HarmonyOS 6】 The target can not be empty. check the build.profile,json5 file of the project... 精华

GeorgeGcs
发布于 2025-9-8 22:51
浏览
0收藏

一、问题背景

【HarmonyOS 6】 The target can not be empty. check the build.profile,json5 file of the project...-鸿蒙开发者社区

The target can not be empty.
check the build-profile.json5 file of the project root directory andmake sure the targets afe modules in configuraton is set lo specifed product: default in applyToProducts

目标不能为空。
检查项目根目录的build-profile.json5文件,并确保配置中的目标afe模块设置为指定的产品:applyToProducts中的默认值

二、解决方案

在工程级build-profile.json5->modules[]->targets[]->applyToProducts中需要有default默认值

"targets": [
  {
    "name": "default",
    "applyToProducts": [
      "default",
      "Community",
      "Ultimate"
    ]
  },
  {
    "name": "free",
    "applyToProducts": [
      "default",
      "Community"
    ]
  },
  {
    "name": "vip",
    "applyToProducts": [
      "default",
      "Ultimate"
    ]
  }
]

applyToProducts实际上用于配置多目标产物,详情参见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-customized-multi-targets-and-products-sample

收藏
回复
举报
回复
    相关推荐