Question

I know this question has been asked many times before, but none of the solutions solved my issue. I have an APK saved on internal memory: "/data/data/[package-name]/files/0.apk" I saved it using:

openFileOutput("0.apk", Context.MODE_WORLD_READABLE);

I want to install it using the following code, but I am getting "There was a problem parsing the package"

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(context.getFilesDir(), "0.apk")), "application/vnd.android.package-archive");
context.startActivity(intent);

And LogCat says, "Parse error when parsing manifest. Discontinuing installation". Please help me solve this problem.

Edit: I decided to use external storage for my file. When I copied my file to the sd card and tried to install it by the above code, everything was alright. But when I downloaded the apk and stored it on sd card, the same "Parse error..." showed up again. At first, I assumed that it's because of a corrupted apk, but when I tried to install it outside my app, it worked.

Was it helpful?

Solution

The "Parse error when parsing manifest. Discontinuing installation" error usually shows up when you are trying to install an app that is already installed by other means. For instance if you have an app with the same package name that you installed through the PlayStore and now you are trying to install form adb or vice versa.

Another option that will probably give less headaches, is to copy the apk to the users external storage folder, and then try to open it.

OTHER TIPS

It might be caused by the permission issue. Please copy the apk file to the external storage instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top