Ionic Android Pack apk--Android signature

Source: Internet
Author: User

Last week, the project on-line, looked at the online package of blog, feeling is not very clear I myself to summarize the next

  

First, when we build the Android apk in the root directory of the project, the command executed must be ionic build android-release instead of ionic build Android. So the signed APK will run properly on the phone. Otherwise it may prompt: Signature check failed, if is build Android APK this is System automatic signature, we want to sign manually

Ionic build android-release After executing this command, the installation package will be here

  

The following cmd command we need to go into the platforms/android directory to execute. Otherwise it may not install properly

To sign the APK to use 3 tools, or 3 commands, respectively: Keytool, Jarsigner, the following is a brief description of the 2 tools:

1) Keytool: Generate a digital certificate, that is, the key, that is, the type of file with the extension. KeyStore mentioned above;
2) Jarsigner: Use digital certificate to sign APK file;

1) Keytool: The tool is located in the bin directory of the JDK installation path;
2) Jarsigner: The tool is located in the bin directory of the JDK installation path;

It is not known whether people notice that the Keytool and Jarsigner two tools are the JDK, which means that the generation of digital certificates and file signatures is not a patent for Android, and it is also literally understood that the tool is primarily used to sign the jar file, Jarsigner.

1. Generate digital certificates using the Keytool tool

Keytool-genkey-v-keystore liangzai.keystore-alias liangzai.keystore-keyalg rsa-validity 20000

1) Keytool is the tool name,-genkey means to generate a digital certificate operation, and-V to print out the details of the generated certificate, displayed in the DOS window;
2)-keystore Liguangyang.keystore indicates the file name of the generated digital certificate is "Liufeng.keystore";
3)-alias Liguangyangw.keystore that the certificate alias is "Liguangyangw.keystore", of course, it can not be the same as the above file name;
4)-keyalg RSA indicates that the algorithm used to generate the key file is RSA;
5)-validity 20000 indicates that the digital certificate is valid for 20,000 days, meaning that the certificate will expire after 20,000 days
When you execute the above command to generate a digital certificate file, you are prompted to enter some information, including the certificate's password, as shown in the following example:

  

2 "sign Android app with Jarsigner tool
Jarsigner-verbose-keystore Liaguangyang.keystore-signedjar notepad_signed.apk notepad.apk liaguangyang.keystore
Description
1) Jarsigner is the tool name,-verbose indicates the details of the signature process is printed out, displayed in the DOS window;
2)-keystore Liaguangyang.keystore indicates the location of the digital certificate used by the signature, there is no write path, which is indicated in the current directory;
3)-signedjar yun.apk notepad.apk to notepad.apk file signature, signed file name is notepad_signed.apk;
4) The last Liaguangyang.keystore represents the alias of the certificate, which corresponds to the name after the-alias parameter when generating the digital certificate

As follows:

  

This creates an app with a signed name.

Remember that signing certificate must be under the same path as the APK package in order to sign successfully or you will be prompted to fail the signature

Ionic Android Pack apk--Android signature

Related Article

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.