鸿蒙北向应用开发: deveco5.0 创建开源鸿蒙项目

发布于:2025-05-14 ⋅ 阅读:(63) ⋅ 点赞:(0)

本地已经安装deveco5.0

使用5.0创建开源鸿蒙项目

文件->新建->新建项目

直接创建空项目,一路默认 next

直接编译项目

直接连接开源鸿蒙5.0开发板编译会提示

compatibleSdkVersion and releaseType of the app do not match the apiVersion and releaseType on the device.

应用程序的 SDK 版本或发布类型(releaseType)与设备上当前操作系统的版本不兼容

修改配置

查看项目级的build-profile.json5,可以看到当前默认的是鸿蒙配置,将这里修改为开源鸿蒙配置

将原来的

"compatibleSdkVersion": "5.0.3(15)",
"runtimeOS": "HarmonyOS",
"buildOption": {
  "strictMode": {
    "caseSensitiveCheck": true,
    "useNormalizedOHMUrl": true
  }
}

修改为

"compatibleSdkVersion": 14,
"compileSdkVersion": 14,
"targetSdkVersion": 14,
"runtimeOS": "OpenHarmony",
"buildOption": {
  "strictMode": {
    "caseSensitiveCheck": true,
    "useNormalizedOHMUrl": true
  }
}

点击立即同步

说明:

打开  文件->设置->OpenHarmony SDK

这里的14是sdk版本,需要跟你的板子烧录的镜像版本对应

再次编译运行项目

提示未签名

添加默认签名

再次编译运行签名后的项目

提示:

Install Failed: error: failed to install bundle.
code:9568332
error: install sign info inconsistent.
View detailed instructions.
You can also uninstall and reinstall the modules.
16:15:22.495: $ hdc shell rm -rf data/local/tmp/eeddc4203d4f49faba465a061b2d3f0d
16:15:22.496: Launch com.example.myapplication failed, starting handle failure progress
Error while Deploy Hap
 

卸载原来的安装并重新安装

直接点击uninstall and reinstall the modules.


网站公告

今日签到

点亮在社区的每一天
去签到