Problems encountered in hbuilderx cloud packaging
Posted May 25, 2020 • 3 min read
The Android platform packages and releases the apk application, which needs to be signed with a digital certificate(.keystore file) to indicate the identity of the developer.
Android certificate generation is self-service and free, without approval or payment.
It can be generated using the keytool command in the JRE environment. The following is the method of generating a certificate on the windows platform:
Install JRE environment(skip if there is already)
The jre installation package can be downloaded from Oracle's official website:
The following takes the installation directory as "C:\ Program Files \ Java \ jre1.8.0 \ _201" as an example, please change to your own installation directory during actual operation
It is recommended to add the JRE installation path to the system environment variables, and you can skip this chapter if you have already configured it
Open the command line(cmd) and enter the following command:
d: set PATH =%PATH%; "C:\ Program Files \ Java \ jre1.8.0_201 \ bin"
- First line:switch working directory to D:path
- Second line:add jre command to temporary environment variable
Generate a signing certificate
Use the keytool -genkey command to generate a certificate:
keytool -genkey -alias testalias -keyalg RSA -keysize 2048 -validity 36500 -keystore test.keystore
testalias is a certificate alias, which can be modified to the character you want to set, it is recommended to use English letters and numbers
test.keystore is the name of the certificate file, which can be modified to the file name you want to set, or you can specify the full file path
Enter keystore password://Enter the password of the certificate file and press Enter when finished
Re-enter new password://Enter the password of the certificate file again, and press Enter when finished
What is your first and last name?
[Unknown]://Enter the first name and last name, and press Enter to complete
What is the name of your organizational unit?
[Unknown]://Enter the name of the organization unit, and press Enter to complete
What is the name of your organization?
[Unknown]://Enter the name of the organization
What is the name of your City or Locality?
[Unknown]://Enter the name of the city or area, and press Enter to complete
What is the name of your State or Province?
[Unknown]://Enter the name of the province/city/autonomous region, and press Enter when finished
What is the two-letter country code for this unit?
[Unknown]://Enter the country code(two letters), China is CN, and press Enter to complete
Is CN = XX, OU = XX, O = XX, L = XX, ST = XX, C = XX correct?
[no]://Confirm whether the content entered above is correct, enter y and press Enter
Enter key password for
(RETURN if same as keystore password)://Confirm that the certificate password is the same as the certificate file password(HBuilder | HBuilderX requires these two passwords to be the same), just press Enter
View certificate information
keytool -list -v -keystore test.keystore Enter keystore password://Enter the password and press enter Keystore type:PKCS12 Keystore provider:SUN Your keystore contains 1 entry Alias name:test Creation date:2019-10-28 Entry type:PrivateKeyEntry Certificate chain length:1 Certificate : Owner:CN = Tester, OU = Test, O = Test, L = HD, ST = BJ, C = CN Issuer:CN = Tester, OU = Test, O = Test, L = HD, ST = BJ, C = CN Serial number:7dd12840 Valid from:Fri Jul 26 20:52:56 CST 2019 until:Sun Jul 02 20:52:56 CST 2119 Certificate fingerprints: MD5:F9:F6:C8:1F:DB:AB:50:14:7D:6F:2C:4F:CE:E6:0A:A5 SHA1:BB:AC:E2:2F:97:3B:18:02:E7:D6:69:A3:7A:28:EF:D2:3F:A3:68:E7 SHA256:24:11:7D:E7:36:12:BC:FE:AF:2A:6A:24:BD:04:4F:2E:33:E5:2D:41:96:5F:50:4D:74:17:7F:4F:E2:55:EB:26 Signature algorithm name:SHA256withRSA Subject Public Key Algorithm:2048-bit RSA key Version:3