Android development, installation of APK with a special character name, problems occurred when parsing the package

Source: Internet
Author: User

Today, the program has a bug. If you change the APK name to include "%", the "Resolution package is faulty" will occur and the installation will not continue, I read the code for installing the program for half a day:

01. intent intent = new intent (intent. action_view); 02. intent. setflags (intent. flag_activity_new_task); 03. intent. setdataandtype (URI. parse ("file: //" + filepath), 04. "Application/vnd. android. package-Archive "); 05. getapplicationcontext (). startactivity (intent );

The URI is found at last. parse ("file: //" + filepath), the question of this function, Uri. parse parameters cannot contain special characters, For details, refer to (http://www.jb51.net/article/21691.htm), and finally modify

Uri. fromfile (new file (filepath ).

 

The following common causes are also found for reference:

1. Incorrect format
For example, if the image is compressed as RAR by WinRAR, we recommend that you use the decompression tool to open the original APK package and check whether there is any embed in it. **

2. Signature Error
When a signature error occurs due to various reasons in the downloaded APK, an error is reported. You can download the APK package again or find an APK package provided elsewhere to solve this problem.

3. parsing error
Due to system reasons, the APK file name or some characters in the folder may be incorrectly parsed or cannot be parsed, common phenomena include Chinese characters, special characters, special characters, and specific strings (for example, % 20%). Therefore, you need to rename the APK package and folder to solve this problem.

My question is a third special symbol.

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.