【发布时间】:2015-08-10 20:32:09
【问题描述】:
我正在创建应用程序自定义更新程序,更新时出现 Parse 错误。
我使用 AsyncTask 下载签名的 apk
output = new FileOutputStream(context.getFilesDir()+"/update.apk");
下载成功完成,然后我尝试像这样运行apk:
File file = new File("file://"+context.getFilesDir(), "update.apk");
file.setReadable(true, false);
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
promptInstall.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
promptInstall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(promptInstall);
应用程序开始更新,但随后解决了我的问题,
Parse Error: An error occurred while parsing the package
我做错了什么?
【问题讨论】:
-
您是否启用了未知来源的应用安装?
-
是的,我已经安装了应用程序,只是想制作自定义更新程序
-
也许这就是您要找的东西? stackoverflow.com/questions/4967669/…
标签: android android-intent android-activity android-file start-activity