HarmonyOS鸿蒙Next中更改app.json5里面的bundleName以后运行不起来
HarmonyOS鸿蒙Next中更改app.json5里面的bundleName以后运行不起来
我把 bundleName 从 com.example.screen_check 改成 com.example.EnglishSpeech后启动报错
10:46:48.223: Build task in 1 s 938 ms
10:46:48.223: Launching com.example.screen_check(还是启动的com.example.screen_check,重新构建也没用)
10:46:48.223: $ hdc shell aa force-stop com.example.screen_check
10:46:48.349: $ hdc shell mkdir data/local/tmp/91461481c992456baf975e58fc177068
10:46:48.522: $ hdc file send C:\Users\Administrator\Desktop\hongmeng\english_speech\entry\build\default\outputs\default\entry-default-unsigned.hap “data/local/tmp/91461481c992456baf975e58fc177068” in 173 ms
10:46:48.793: $ hdc shell bm install -p data/local/tmp/91461481c992456baf975e58fc177068 in 271 ms
10:46:48.819: $ hdc shell rm -rf data/local/tmp/91461481c992456baf975e58fc177068
10:46:49.048: $ hdc shell aa start -a EntryAbility -b com.example.screen_check in 179 ms
10:46:49.049: Launch com.example.screen_check failed, starting handle failure progress
error: failed to start ability.Error Code:10104001 Error Message:The specified ability does not existError cause: The specified Ability is not installed Try the following: > Check if the parameter abilityName of aa -a and the parameter bundleName of -b are correct > Check if the application corresponding to the specified bundleName is installed > For multi-HAP applications, it is necessary to confirm whether the HAP to which the ability belongs has been installed
Error while Launching ability
更多关于HarmonyOS鸿蒙Next中更改app.json5里面的bundleName以后运行不起来的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在HarmonyOS Next中修改app.json5的bundleName后无法运行,是因为bundleName必须与工程配置保持一致。检查以下内容:
- bundleName需与module.json5中的"name"字段匹配
- 确保bundleName在全局唯一
- 格式应为反向域名形式(如com.example.app)
- 修改后需清理工程并重新构建
若仍报错,检查build-profile.json5中的配置是否同步更新。
更多关于HarmonyOS鸿蒙Next中更改app.json5里面的bundleName以后运行不起来的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
从日志看,虽然你修改了app.json5中的bundleName,但构建系统仍然使用旧的包名com.example.screen_check进行部署。这通常是由于缓存问题导致的。需要执行以下操作:
- 执行Clean Project(菜单栏Build > Clean Project)
- 删除项目目录下的build文件夹
- 删除设备上已安装的旧应用(可通过hdc shell pm uninstall com.example.screen_check)
- 重新构建并运行项目
另外请检查:
- module.json5中的bundleName是否同步修改
- 确保所有配置文件中没有残留旧包名
- 查看gradle缓存目录(~/.gradle/caches)是否有旧配置残留
如果问题依旧,可以尝试新建一个空白项目测试包名修改是否生效,以确认是否是项目配置问题。