We mentioned in the previous section how to package a hybrid application. So when we pack, we need to publish, the release needs to use a different key, then do these key how to generate it. 1. Use the Keytool command provided in the JDK to generate a signing certificate
Of course, when you use this command, please add keytool to the environment variable.
Have you seen these xxx? They are actually your package name and will prompt you to name it when we create the application. If not named in time, called Hello World also does not matter, can change. However, it is recommended that all use a uniform name to facilitate maintenance.
Keytool-genkey-v-keystore xxxx.keystore-alias xxxx-keyalg rsa-validity 365
Generally, we will have a proprietary key folder, placed in the root directory, the creation of key, you can use the relative path, directly put the KeyStore under the key folder.
Detailed Command Reference:
Http://www.cnblogs.com/kungfupanda/archive/2010/09/01/1815047.html
Attention:
The various details to generate the secret key should be recorded so that you can query later.
Examples are as follows:
Secret key password 87654321
password 87654321 name:
yueshenghu
organizational unit name:
Shenzhen Aerospace Intelligent City System Engineering Technology Research Institute
Organization name:
China space
City Name:
Shenzhen
Provinces and autonomous regions name:
Guangzhou
country, Region code:
CN
At the same time, once the signature is successful, please upload the secret key to Git store on time, otherwise it will cause a lot of trouble if the secret key is lost. 2. Use the secret key generated by Keytool to sign our app
If you use Build.json, this step can be ignored. The method of step "3" is recommended.
Of course, Jarsigner is also to be added to the environment variable.
Jarsigner-keystore xxxx.keystore-digestalg sha1-sigalg Md5withrsa xxxx-release-unsigned.apk XXXX
3. Generate Package Description file
Create a new file named Build.json and put it under the root directory.
File specific content, you can refer to the following content. This time you will find that the alias that created the app works.
{"
Android": {"
Debug": {
"KeyStore": "./key/dapengwater1.0.debug.keystore",
"Storepassword": " ascsdapeng0815 ",
" Alias ":" Dapengwater1.0.debug ",
" password ":" ascsdapeng0815 ",
" Keystoretype ":" "
},
"release": {
"KeyStore": "./key/dapengwater1.0.keystore",
"Storepassword": "ascsdapeng0815 ",
" Alias ":" daPengWater1.0 ",
" password ":" ascsdapeng0815 ",
" Keystoretype ":" "
}
}
}