水泥钉
水泥钉
  • 发布:2023-08-07 17:07
  • 更新:2023-08-07 17:30
  • 阅读:550

【报Bug】使用plus.runtime.install安装整包apk时 返回null

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 3.8.7

手机系统: Android

手机系统版本号: Android 13

手机厂商: 荣耀

手机机型: x40

打包方式: 云端

操作步骤:

点击下载 链接为 _doc/uniapp_temp_1691398245478/download/16913982239091.apk, 权限配置
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
"targetSdkVersion" : 26,
"minSdkVersion" : 19
都配置了 还是返回null

预期结果:

正常安装 错误函数能够返回具体错误!!!!

bug描述:

    const downloadTask = uni.downloadFile({  
            url: that.latest.androidUrl,  
            success: res => {  
                console.log(res, "--res");  
                if (res.statusCode === 200) {  
                    that.$refs.guipopup.close();  
                    console.log(res.tempFilePath, "=====res.tempFilePath");  
                    // 安装文件  
                    plus.runtime.install(  
                        res.tempFilePath,  
                        {  
                            force: true,  
                        },  
                        function () {  
                            console.log(1);  
                            // 重启应用  
                            plus.runtime.restart();  
                        },  
                        function (e) {  
                            console.log(e);  
                            console.error(e, "install fail...");  
                        }  
                    );  
                }  
            },  
        });  
2023-08-07 17:07 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

  • 水泥钉 (作者)

    配置了的

    2023-08-07 17:36

  • 水泥钉 (作者)

    我的妈啊 他妹的 找到问题了 有点坑 后台使用切片上传 但是有掉点!!!导致包不完整 后端又没有处理异常情况 调用install 也没有具体错误提示 只返回null 后面调用openFile 使用系统自带的安装程序 才爆出 解析安装包错误 才发现问题 install ap居然撒子提示都没有

    2023-08-07 19:46

  • 喜欢技术的前端

    回复 7***@qq.com: 害,文件不大,直接整包上传,切片得组合起来(●'◡'●)

    2023-08-08 09:28

要回复问题请先登录注册