我在React Native中制作了一个应用程序项目,我想构建它的apk。我正在遵循此处所示的官方文档https://reactnative.dev/docs/signed-apk-android。
它说我必须首先使用
keytool
生成私人签名密钥。我已按照 Windows 的说明进行操作。这是终端输出:
PS C:\Program Files\Java\jdk1.8.0_271\bin> keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: My Name
What is the name of your organizational unit?
[Unknown]: Myself
What is the name of your organization?
[Unknown]: OrgName
What is the name of your City or Locality?
[Unknown]: CityName
What is the name of your State or Province?
[Unknown]: StateName
What is the two-letter country code for this unit?
[Unknown]: XY
Is CN=My Name, OU=Myself, O=OrgName, L=CityName, ST=StateName, C=XY correct?
[no]: yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=My Name, OU=Myself, O=OrgName, L=CityName, ST=StateName, C=XY
[Storing my-upload-key.keystore]
PS C:\Program Files\Java\jdk1.8.0_271\bin>
紧接着,文档说我必须将生成的密钥库密码和密钥密码输入到此文件中
将
文件放置在项目文件夹中的my-upload-key.keystore
目录下。android/app
编辑文件
或~/.gradle/gradle.properties
,并添加以下内容(将android/gradle.properties
替换为正确的密钥库密码、别名和密钥密码),*****
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore MYAPP_UPLOAD_KEY_ALIAS=my-key-alias MYAPP_UPLOAD_STORE_PASSWORD=***** MYAPP_UPLOAD_KEY_PASSWORD=*****
我记得当 keytool 提示时创建了“密钥库密码”,但我不记得曾经见过或生成“密钥密码”。
也许这是一个老生常谈的问题,但我如何找到我的“关键密码”?甚至其他教程网站似乎也假设用户已经拥有或知道它。我现在必须创建“密钥密码”吗?