An error occurred while parsing the package and installing the APK with code is problematic

Source: Internet
Author: User

Intent Intent = new Intent (Intent.action_view);

Intent.setdataandtype (uri.fromfile (file),"Application/vnd.android.package-archive");

StartActivity (Intent);

File for an APK files, the installation of the time there is always a package parsing error, the APK file with the ADB normal installation boot.

Baidu, did not find a good solution, a master colleague appeared.

The first one, to provide a solution to the idea, because this file is I check the update pulled down from the server apk file, this apk is another small partner uploaded to the server, the signature is not the same.

Consider the following version of my app's manifest.xml file to be the same as the server, run it again, the high version of the compilation, from the bin directory and put it in my installation directory.

Run the app, do not install the server apk file, but run my own only elevated version number of the app, found that can run the installation. However, once switched to the server above, the packet parsing exception is still.

One thing to note here is that the name of the package being installed is consistent with the name of the project. I am here and the name of project is kept without exception, that is, I am writing this file

Name, it's best to have the same name as project. There may be a broader requirement to be tested

Second, find my installation directory may be a problem, I proposed to change the installation directory to the SD card directory, and not my previous application under the file folder. The result changes the folder, sure enough can install.

An error occurred while parsing the package and installing the APK with code is problematic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.