大概整理一下如下:
以下資料參考來源:https://taco.visualstudio.com/en-us/docs/tutorial-package-publish-readme/
Generate a private key
To sign your app, create a keystore. A keystore is a binary file that contains a set of private keys. Here's how you create one.
- Open a Command Prompt in administrator mode.
- In the Command Prompt, change directories to the
%JAVA_HOME%\bin
folder.(For example:C:\Program Files (x86)\Java\jdk1.7.0_55\bin
). - In the Command Prompt, run the following command.
keytool -genkey -v -keystore c:\my-release-key.keystore -alias johnS -keyalg RSA -keysize 2048 -validity 10000
Replacemy-release-key.keystore
andjohnS
with names that make sense to you. - You'll be asked to provide a password and the Distinguished Name fields for your key.This series of responses gives you an idea of the kinds of information you'll provide for each prompt. Like in the previous command, respond to each prompt with information that makes sense for your app.
Enter keystore password: pwd123 Re-enter new password: pwd123 What is your first and last name? [Unknown]= John Smith What is the name of your organizational unit? [Unknown]= ABC What is the name of your organization? [Unknown]= XYZ What is the name of your of your City or Locality? [Unknown]= Redmond What is the name of your State or Province? [Unknown]= WA What is the two-letter country code for this unit? [Unknown]= US Is CN=John Smith, OU=ABC, O=XYZ, L=Redmond, ST=WA, C=US correct?? [no]= y
After you provide this information, output like this appears in the Command Prompt.Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days for: CN= John Smith, OU= ABC, O= XYZ, L=Redmond, ST=WA, C=US Enter key password for <johnS> (RETURN if same as keystore password):
The Android SDK generates the keystore as a file named my-release-key.keystore and places that file in the C:\ drive. The keystore contains a single key, valid for 10000 days.If you want more detail about this process, see the Android developer documentation here:Signing your applications
照以上步驟後會產生一個key在你指定的位置,之後到apk原碼的資料夾中應該有一個build.json的檔案,打開後把裡面分別照自己設定的填入,照上方範例的話就是
{ "android": { "release": { "keystore":"c:\\my-release-key.keystore", "storePassword":"pwd123", "alias":"johnS", "password":"pwd123", "keystoreType":"" } } }之後打包後安裝就沒金鑰問題了。
沒有留言:
張貼留言