search

Home  >  Q&A  >  body text

android 程序更新版本遇到的问题

通过请求获取了123.apk包,保存在文件中,通过下面的方法去安装的时候提示解析包失败,我去文件夹下面手动安装123.apk可以安装成功,怎么解决。

Intent intent = new Intent(Intent.ACTION_VIEW);

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    intent.setDataAndType(Uri.fromFile(new File(Environment
    .getExternalStorageDirectory(), "123.apk")),
    "application/vnd.android.package-archive");
    startActivity(intent);
伊谢尔伦伊谢尔伦2946 days ago459

reply all(1)I'll reply

  • 阿神

    阿神2017-04-17 13:51:39

    Found it to be a permissions issue.
    After checking the information, I found this: fileOutputStream = openFileOutput("YouPaoPao.apk", MODE_WORLD_READABLE);
    Write in this form when writing files, and no parsing package errors will be reported when reading and installing.

    reply
    0
  • Cancelreply