Recent projects require,Programming with ndk, encountered some problems,When accessing the underlying device,Permission denied,Later I looked up the information on the Internet,At first I thought I had root privileges.To get aroundPrograms cannot obtain root permissions, and later found that they could access the device with system permissions.There are 2 methods found online, one is to compile in source code,The second is to modify the key.I just started to make android, I don't know the source code,I chose the second method.

Here are the steps:

1. In the code,In the manifest entry of the androidmanifest.xml file, add


2, compile the program,Get apk file, such as src.apk

3. Open the apk file with compression software.Delete the cert.sf and cert.rsa files in the meta-inf directory

4.Run the command (where the 3 files of signapk.jar platform.x509.pem platform.pk8 can be found in the build directory of the source code)

java -jar signapk.jar platform.x509.pem platform.pk8 src.apk dst.apk

5, dst.apk has system permissions after installation, you can access the device

  • Previous Access validation setting method for HTML pages in ASPNET
  • Next PHP Lottery Algorithm Program Code Sharing