HarmonyOS DevEco Studio彻底修改工程名称

2025-05-21  本文已影响0人  龙之天下

1、关闭项目

2、将项目文件夹替换为新的名称后重新打开项目

3、将AppScope/app.json5 中的bundleName 改为新的包名

{
  "app": {
    "bundleName": "com.example.newname", //改为新的包名
    "vendor": "example",
    "versionCode": 1000000,
    "versionName": "1.0.0",
    "icon": "$media:app_icon",
    "label": "$string:app_name"
  }
}

4、将AppScope/resources/base/element/string.json 中的app_name 改为新的名称

{
  "string": [
    {
      "name": "app_name",
      "value": "newname" //将app_name替换为新的名称
    }
  ]
}

5、将oh-package.json5 中的name 改为新的名称

{
  "license": "",
  "devDependencies": {
    "@ohos/hypium": "1.0.6"
  },
  "author": "",
  "name": "newname", //替换为新的名称
  "description": "Please describe the basic information.",
  "main": "",
  "version": "1.0.0",
  "dependencies": {}
}

6、将build-profile.json5 中的签名信息删除 重新签名

 在build-profile.json5 文件中app字段的signingConfigs字段的对应签名删除
signingConfigs配置.png

7、将.hvigor/cache/file-cache.json 和 .hvigor/cache/task-cache.json 两个缓存文件中的 旧工程名全部替换为新工程名

8、选择 file -> invalidate Caches... 全勾选 执行清除缓存并重启IDE

9、重新运行项目

上一篇 下一篇

猜你喜欢

热点阅读