OpenHarmony开发者论坛

标题: Cocos Creator工程发布到OpenHarmony [打印本页]

作者: 深开鸿-唐艺丹    时间: 2024-11-8 16:11
标题: Cocos Creator工程发布到OpenHarmony
[md]# Cocos Creator工程发布到OpenHarmony

## 准备工作

**1.下载Cocos Creator3.8.3oh版本**

**2.下载最新的IDEevEco Studio 5.0 release(5.0.3.900)**

[DevEco Studio-HarmonyOS Next Beta版-华为开发者联盟](https://developer.huawei.com/consumer/cn/deveco-studio/#download)

**3.OpenHarmany 系统镜像与SDK下载(这里选用4.1 Release)**

[zh-cn/release-notes/OpenHarmony-v4.1-release.md · OpenHarmony/docs - 码云 - 开源中国](https://gitee.com/openharmony/do ... ony-v4.1-release.md)

![image-20241108143826659.png](https://forums-obs.openharmony.c ... s61us1uuozkt11c.png "image-20241108143826659.png")

4. **dayu200 开发板**

## 操作步骤

**1.Cocos Creator打开已经做好的项目**

![image-20241108144640701.png](https://forums-obs.openharmony.c ... qndb2w4j1yhfey2.png "image-20241108144640701.png")

**2.打开项目后选择项目-构建发布**

![image-20241108145139647.png](https://forums-obs.openharmony.c ... xzxszyytqxjjpxy.png "image-20241108145139647.png")

**3.打开构建发布后,新建构建任务,选择发布平台为OpenHarmony,配置好游戏名称和初始场景,选择是否发布release,以及32位系统与64位系统,配置横屏与竖屏的选择**

![image-20241108152109786.png](https://forums-obs.openharmony.c ... vggsjj74jj7jjuk.png "image-20241108152109786.png")

![image-20241108153112689.png](https://forums-obs.openharmony.c ... x9i0u5vsefze76v.png "image-20241108153112689.png")

**4.配置完后点击构建就可以了(目前点击生成和运行会失败,所以只用做构建这一个操作),生成的OpenHarmony工程在Cocos原本的工程目录下的native/engine/openharmony这个目录下**

![image-20241108153513256.png](https://forums-obs.openharmony.c ... 9q45icrcwioiier.png "image-20241108153513256.png")

**5.生成的OpenHarmony工程再用Dev Eco Studio打开**

**初始化时可能会产生如下报错,这个时候就需要我们把工程配置转为openharmony工程**

![image-20241108154522171.png](https://forums-obs.openharmony.c ... 84dinh41zyy8itc.png "image-20241108154522171.png")

**将根目录下面的build-profile.json5里面的内容**

![image-20241108154859984.png](https://forums-obs.openharmony.c ... vk7wv0im407goi0.png "image-20241108154859984.png")

**修改为如下图所示即可,然后重新进行签名、编译,可以成功生成hap包并推送到开发板上**

![image-20241108154957656.png](https://forums-obs.openharmony.c ... dazc6upp15km7x5.png "image-20241108154957656.png")


[/md]




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5