Shared user id/Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE

Source: Internet
Author: User

-----

When compiling android source code through eclipse on windows, if the shared user id in Settings or android manifest XML contains system permissions such as android. uid. shared, the following error is reported.

Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE

INSTALL_FAILED_UPDATE_INCOMPATIBLE
1. Because the uninstallation is not complete, you can use the settings to uninstall the corresponding application, or adb uninstall com. android .***

INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
It is mainly caused by the use of android. uid. shared.
The solution is as follows:
The first method is simple, but it needs to be compiled using make in the environment of the Android system source code:

1. Modify the Android. mk file and add LOCAL_CERTIFICATE: = platform.
2. Use the mm command to compile and run the generated apk in the simulator.


The second method is troublesome, but you do not need to run the virtual machine to the source code environment and use make to compile it:

1. Compile the apk file using eclipse, but this apk file cannot be used.
2. Check the Android. mk file, add local_certificate: =, and select the corresponding signature based on the content of this line.
Platform -----> platform. pk8 and platform. x509.pem
Shared -----> shared. pk8 and shared. x509.pem
3. Use the platform key of the target system to re-sign the APK file. This step is troublesome,
First, find the key file in the my android source code directory.
Is "build/target/product/security", the following Platform. pk8 and platform. x509.pem
Two files.
Then use the signapk tool provided by Android to sign the signature. The source code of signapk is
Under "build/tools/signapk,
The usage is "Java-jar signapk. Jar platform. x509.pem platform. pk8 input.apk output.apk ",
It is best to use an absolute path for the file name to prevent it from being found. You can also modify the source code to use it directly.

4. Other APPS can run normally according to this method,

However, the program generated in this way can only be used in the original Android system or a self-compiled system, because such a system can get the platform. pk8 and
Platform. x509.pem files. If other companies do not even install Android. Try the original Android key to sign the program.
Run OK on the parsers, but the prompt "Package... has no signatures that match those in
Shared user android. uid. system ", which also protects the system security.

Finally, the android: sharedUserId attribute can not only put the apk in the system process, but also configure multiple APK to run in one process to share data, it should be very useful.

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.