Android APP自动更新时,跳转到安装界面时出现解析失败
发布日期:2021-07-30 03:26:15 浏览次数:14 分类:技术文章

本文共 686 字,大约阅读时间需要 2 分钟。

1、记录一个问题,Android APP自动更新时,跳转到安装界面时出现解析失败,解决办法:

原因是下载文件的权限不正确
因为安装时会跳转到其他应用,其他应用没有改文件的读写权限

Intent intent = new Intent(Intent.ACTION_VIEW);intent.setDataAndType(Uri.parse("file://"+filePath), "application/vnd.android.package-archive");intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(intent);

修改文件的权限即解决问题

try {                        //处理安装时,出现解析失败的问题                        String[] command = {"chmod", "777", new File(PATH + "Xt.apk").getPath()};                        ProcessBuilder builder = new ProcessBuilder(command);                        builder.start();                    } catch (IOException e) {                        e.printStackTrace();                    }

转载地址:https://blog.csdn.net/u010886975/article/details/85238755 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:记录一个好用的Bitmap工具类
下一篇:CrashHandler使用,保存错误信息到SD卡文件中

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年03月22日 16时35分00秒