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.