Current location - Quotes Website - Signature design - How to sign an Android application
How to sign an Android application
Whether it's a simulator or a real mobile phone. Therefore, before running the debugging program on the device or simulator, you must set the digital signature for the application. All programs must be signed. Without a signed program, the system will not be installed. Self-signed certificates can be used to sign applications without authorization credentials. The system will only test the validity of the signing certificate at the time of installation. If the application's signature expires after installation, the application can still be enabled normally. You can use standard tools-Keytool and Jarsigner-to generate a key to sign. Apk file of the application. The Android SDK tool can sign the application when debugging. ADT plug-ins and Ant compiler tools provide two signature modes-debugging mode and publishing mode. In debugging mode, the compiler tool uses the general program Keytool of JDK to create secret locks and keys through known methods and passwords. At each compilation, the tool uses the debug key to sign the application's. Apk file. Because the password is known, the tool does not need to prompt for the secret lock and key every time it compiles. When an application is debugged and ready for release, it can be compiled in release mode. In publish mode, the compiler will not set the. Apk file. You need to use Keytool to generate your own key and secret lock, and then use JDK's Jarsigner tool pair. Apk file. The basic setting of signature first sets the JAVA_HOME environment variable to tell SDK how to find Keytool, or you can add the JDK PATH of Keytool to the Windows system environment variable Path variable. When publishing the release version, press and select your project in the package panel, press the right mouse button, and then select Android Tools and Export Application Package. Or you can click Export unsigned. Apk "link to export unsigned apk files. After saving. Apk file, signed with Jarsigner and his own key. If you don't have a key, you can create a key and a secret lock with the keystore. If you already have a key, such as a public key, you can set the. Apk file. You can also write the above complete steps into a bat file, so you only need to run this bat when you need to sign. The following is a complete bat file example: @Rem Android signing program//comment instruction @Rem echo is the display instruction format: echo [{on | off}] [message] @ echo * * * * * * * * * * * * * * * * * * * * * * * * * * * Is there a command format in the @Rem file: iExist path+file name command @ iexist d: sign/myfirstapp? Keystore gotosign @ echo creates signature file MyFirstApp.keystore@Rem keytool command format: -genkey generates signature-alias -keyalg encryption algorithm-days of validity -keystore production signature file name keytool-g. Enkey- alias myfirstapp.keyst. Ore-keyarsa- valid for 40000-keystoremyfirstapp. keystore @ echo Start signing: