连续热更新两次

- 发布:2024-12-24 16:04
- 更新:2025-06-17 17:07
- 阅读:337
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 14.4.1 (23E224)
HBuilderX类型: 正式
HBuilderX版本号: 4.36
手机系统: HarmonyOS NEXT
手机系统版本号: HarmonyOS NEXT Developer Preview
手机厂商: 华为
手机机型: mate60
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
可以更新
可以更新
实际结果:
不可以更新
不可以更新
bug描述:
鸿蒙热更新plus.runtime.install第一次热更新成功,第二次失败


码思泉涌 - y
// 在执行plus.runtime.install 之前,在鸿蒙原生端执行以下方法,清除掉旧缓存,就可以正常更新(需要UTS插件配合),在4.45 (uni-runtime 2.3.18)上测试通过
async removeTempDir(){
const path = getContext().getApplicationContext().tempDir + '/HBuilder/__temp_wgt'
const isExist = await fileIo.access(path)
if (isExist) {
await fileIo.rmdir(path)
}
const path2 = getContext().getApplicationContext().filesDir + '/apps'
const isExist2 = await fileIo.access(path2)
if (isExist2) {
await fileIo.rmdir(path2)
}
}