jc_heisenberg
jc_heisenberg
  • 发布:2025-08-20 16:46
  • 更新:2025-08-21 11:00
  • 阅读:48

鸿蒙5.0 wget 热更新不成功

分类:鸿蒙Next

restart能重启成功,但是页面还是没有更新,现在就是一直重启

let downloadTask = uni.downloadFile({  
                    url: _this.tempFilePath, //下载热更新的链接  
                    success: (downloadResult) => {  
                        _this.percent = downloadResult  
                        console.log(_this.percent)  
                        plus.runtime.install(downloadResult  
                            .tempFilePath, {  
                                force: true  
                            },  
                            function() {  
                                console.log('安装中')  
                                // 应用热重启,重新启动进入首页。  
                                // #ifdef APP-HARMONY  
                                restart()  
                                // plus.runtime.restart();  
                                // #endif  

                            },  
                            function(e) {  
                                console.log(e)  
                                uni.showToast({  
                                    title: '安装失败',  
                                    icon: 'none'  
                                })  
                            })

console台打印

16:32:21.963 [响应]/souce/app_version {status: true, msg: {⁠...⁠}, code: 200} at utils/request.js:43
16:32:21.963 [boolean] true {version: "1.8.7", title: "测试wget包", descr: "测试wget", is_force: 0, downloadurl: "https://test.hy.aogoo.com/upload/187.wgt"} ==== at pages/index/index.vue:564
16:32:21.963 {version: "1.8.7", title: "测试wget包", descr: "测试wget", is_force: 0, downloadurl: "https://test.hy.aogoo.com/upload/187.wgt"} =更新内容 at components/upgrade-popup/upgrade-popup.vue:111
16:32:21.963 [boolean] false [boolean] false [boolean] false [boolean] false at components/upgrade-popup/upgrade-popup.vue:124
16:32:21.981 [响应]/mall/index {status: true, msg: {⁠...⁠}, code: 200} at utils/request.js:43
16:32:25.459 {tempFilePath: "/data/storage/el2/base/cache/HBuilder/uni-download/187(9).wgt", statusCode: 200, errMsg: "downloadFile:ok", errSubject: "downloadFile"} at components/upgrade-popup/upgrade-popup.vue:155
16:32:25.508 安装中 at components/upgrade-popup/upgrade-popup.vue:161
16:32:25.508 bundleInfo {name: "uni.app.UNI387D736", vendor: "example", versionCode: 186, versionName: "1.8.6", minCompatibleVersionCode: 186, ⁠...⁠} at uni_modules/harmony-restart/utssdk/app-harmony/index.uts:16

2025-08-20 16:46 负责人:无 分享
已邀请:
DCloud_UNI_LXH

DCloud_UNI_LXH

使用发行模式,然后把生成产物使用 devEco 打开测试。这里的热更新和 hx 开发时的热更新冲突了。需要使用发行模式测试

要回复问题请先登录注册