Error installing .apk from intent


I’m downloading from a FTP server an .apk file to update my application. My relevant code is:

Intent intent = new Intent(Intent.ACTION_VIEW);
File file = new File(context.getFilesDir() + "/" + filename);
if (file.exists()) {
    intent.setDataAndType(Uri.fromFile(file), "application/");

When the intent is launched (in the last line, context.startActivity(intent);) it just say that there has been an error analyzing the package (or something like that, I’m not sure how the message is in english). The .apk has been signed.

I have not a single clue about what’s wrong, any idea?


The installer process cannot access files on internal storage of your app. And, since last I checked, you cannot install from a ContentProvider, you will have to move the file to some location on external storage.

Answered By – CommonsWare

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published