OpenHarmony-systemui项目工程无法编译的解决办法

发布时间 2023-10-11 22:49:26作者: 梨猫先森

  在探索OpenHarmony 3.2 Release的过程中,我希望通过修改系统软件来使系统更符合HarmonyOS特性,但是在尝试编译systemui时,遇到了这个问题:

hvigor ERROR: 'entryModules' must be configured for a feature module.
    Detail: Set 'entryModules' in the build-profile.json5 file.
    at X:\***\***\build-profile.json5
hvigor ERROR: BUILD FAILED in xxx ms

  该错误是由于feature模块打包配置异常导致的,feature模块需要配置entryModules,而systemui工程中并没有这项配置。

解决方法

由于我的固件形态是phone,因此这里以编译手机固件为例。

  1. 首先,找到项目级的build-profile.json5并打开

     

  2. 将有关pc的模块注释掉

     

     

  3. 找到product下各项目的build-profile.json5

     

  4. 将它们都修改成这样:
    {
      "apiType": 'stageMode',
      "entryModules": ["phone_entry"],
      "targets": [
        {
          "name": "default",
        }
      ]
    }
  5. 重新Sync项目,即可通过编译

  如此修改之后,项目编译通过,替换/system/app/com.ohos.systemui中的包后发现系统可以启动,但systemui无法正常显示,原因暂不明确,待后续解决再发文解释详情及解决方法。