dLucky
dLucky
  • 发布:2025-04-10 11:14
  • 更新:2025-04-11 16:13
  • 阅读:218

【很紧急】请各位官方大大看看,uniapp 鸿蒙热更新wgt提示{errMsg: "Directory not empty"}

分类:uni-app
uni.downloadFile({  
                    url: app?.data.url,  
                    success: function (res) {  
                        console.log('下载成功',res)  
                        if (res.statusCode == 200) {  
                            plus.runtime.install(res.tempFilePath, {  
                                force: true  
                            }, function () {  
                                console.log('安装成功')  
                                uni.$tm.u.toast('更新完毕,即将重启');  
                                setTimeout(() => {  
                                    plus.runtime.restart();  
                                }, 2000)  
                            }, function (e) {  
                                console.log('安装失败',e)  
                                uni.$tm.u.toast(e.message);  
                            });  
                        }  
                    },  
                    fail: function (e) {  
                        console.log('下载失败',e)  
                        uni.hideLoading();  
                        uni.$tm.u.toast(e.errMsg);  
                    }  
                })

这是代码

2025-04-10 11:14 负责人:DCloud_UNI_LXH 分享
已邀请:
DCloud_UNI_LXH

DCloud_UNI_LXH

重启应用再安装是不是就可以了?在本次报错安装之前是否已经进行过一次安装?

  • dLucky (作者)

    是的,我用手机运行的时候就是这样,删除应用后运行第一次更新没有问题,能正常更新,等第二次就会提示

    2025-04-10 21:06

DCloud_UNI_LXH

DCloud_UNI_LXH

替换至 /Applications/HBuilderX-Dev.app/Contents/HBuilderX/plugins/launcher-harmony/base/project.zip(解压)/libs/UniAppRuntime.har 然后重新运行试试看

  • dLucky (作者)

    我明天试试,晚上没有鸿蒙手机

    2025-04-10 21:07

  • dLucky (作者)

    安装失败返回:安装失败 {errMsg: undefined}

    2025-04-11 10:32

  • DCloud_UNI_LXH

    回复 dLucky: 我再看看,一会儿给你个包

    2025-04-11 15:15

  • DCloud_UNI_LXH

    回复 dLucky: 我替换了 har 包,你再试试看

    2025-04-11 16:13

l***@mellson.com

l***@mellson.com

替换了之后,运行到鸿蒙报错 i is not iterable,app安装不了

  • DCloud_UNI_LXH

    app 安装不了,还是 wgt 安装不了?

    2025-04-11 15:13

l***@mellson.com

l***@mellson.com

我的Hbuilder版本是4.57

要回复问题请先登录注册