安卓安装了鸿蒙的wgt包后会白屏 app崩溃无法还原 uni-app

安卓安装了鸿蒙的wgt包后会白屏 app崩溃无法还原 uni-app

开发环境 版本号 项目创建方式
Windows 26100.4946 HBuilderX

产品分类:uniapp/App

PC开发环境操作系统:Windows

PC开发环境操作系统版本号:thinkbook 16+ Windows 11 64位 :26100.4946

HBuilderX类型:正式

HBuilderX版本号:4.75

手机系统:Android

手机系统版本号:Android 16

手机厂商:华为

手机机型:小米14

页面类型:vue

vue版本:vue2

打包方式:云端

项目创建方式:HBuilderX

示例代码:

安装wgt的代码如下

installPackage() {  
    // #ifdef APP-PLUS || APP-HARMONY  
    // wgt资源包安装  
    if (this.isWGT) {  
        this.installing = true;  
    }  

    plus.runtime.install(this.tempFilePath, {  
        force: false  
    }, async res => {  
        this.installing = false;  
        this.installed = true;  
        console.log('安装成功',this.isWGT,this.is_mandatory)  
        // 如果是安装之前的包,安装成功后删除之前的包  
        if (this.installForBeforeFilePath) {  
            await this.deleteSavedFile(this.installForBeforeFilePath)  
            this.installForBeforeFilePath = '';  
        }  

        // wgt包,安装后会提示 安装成功,是否重启  
        if (this.isWGT) {  
            // 强制更新安装完成重启  
            if (this.is_mandatory) {  
                uni.showLoading({  
                    icon: 'none',  
                    title: '安装成功,正在重启……'  
                })  

                setTimeout(() => {  
                    uni.hideLoading()  
                    this.restart();  
                }, 1000)  
            } else {  
                uni.showLoading({  
                    icon: 'none',  
                    title: '安装成功,重启应用体验新版',  
                    duration: 1000  
                })  
            }  
        }  
    }, async err => {  
        // 如果是安装之前的包,安装失败后删除之前的包  
        if (this.installForBeforeFilePath) {  
            await this.deleteSavedFile(this.installForBeforeFilePath)  
            this.installForBeforeFilePath = '';  
        }  

        // 安装失败需要重新下载安装包  
        this.installed = false;  

        uni.showModal({  
            title: '更新失败',  
            content: err.message,  
            showCancel: false  
        });  
    });  

    // 非wgt包,安装跳出覆盖安装,此处直接返回上一页  
    if (!this.isWGT) {  
        uni.navigateBack()  
    }  
    // #endif  
}

更多关于安卓安装了鸿蒙的wgt包后会白屏 app崩溃无法还原 uni-app的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部