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