目录

ArkUI-X工程编译报错“The ArkUI-X project's structure has been changed”

问题现象

使用DevEco Studio 4.0.0.700及以上版本打开ArkUI-X历史工程时,工程同步或构建会提示“ERROR: The ArkUI-X project's structure has been changed. Migrate and adapt the project as instructed in FAQs.”。

解决措施

出现该提示的原因是在旧版本的ArkUI-X工程模板中,ArkUI-X工程标识("crossplatform": true)配置在工程目录下build-profile.json5中,在DevEco Studio 4.0.0.700及以上版本需要在工程目录下.arkui-x/arkui-x-config.json5文件中配置ArkUI-X工程模块、工程标识等信息。

配置位置变更后,使用历史工程模板的开发者,如果使用DevEco Studio 4.0.0.700及以上版本,需手动迁移适配新的工程结构。迁移步骤如下:

  1. 删除工程目录下build-profile.json5中的ArkUI-X工程标识("crossplatform": true)。
  2. 在工程下.arkui-x目录中新建arkui-x-config.json5文件,配置内容为 "crossplatform": true, "modules"中配置工程中所有ArkUI-X模块的module name。

    工程迁移后结构如下:

  3. 迁移完成后,点击菜单栏 File > Sync and Refresh Project 同步工程,然后重新编译构建。