我们必须为 React-Native Android 应用程序重置我们的 Android Upload key 。我们联系了谷歌重置 key 。
Google 要求我们完成以下步骤:
以下是生成和注册新上传 key 的方法:
按照 Android Studio 帮助中心中的说明生成新 key 。它必须不同于任何以前的 key 。或者,您可以使用以下命令行生成新 key :
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
此 key 必须是 2048 位 RSA key ,并且有效期为 25 年。将该 key 的证书导出为 PEM 格式:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
回复此电子邮件并附上 upload_certificate.pem 文件。进一步的步骤
我们现在有了生成的文件,
keystore.jks
和 upload_certificate.pem
文件。以前我们的应用程序使用“***-release-key.keystore”文件上传。
构建过程
gradle.properties 文件
MYAPP_RELEASE_STORE_FILE=APPNAME-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=APPNAMEapprelease
build.gradle 文件def getPassword(String currentUser, String keyChain) {
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
exec {
commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
standardOutput = stdout
errorOutput = stderr
ignoreExitValue true
}
//noinspection GroovyAssignabilityCheck
stdout.toString().trim()
}
def releasekeypass = getPassword("APPNAME","android_keystore")
def releasekeyalias = getPassword("APPNAME","android_keystore")
备注 我们使用 faSTLane 来部署应用程序。我们如何使用我们拥有的新文件获取/更改 .keystore 文件?
最佳答案
文档随便引用.jks
文件为 .keystore
在某些地方。它们是相同的格式。
自己检查:
file APPNAME-release-key.keystore
APPNAME-release-key.keystore : Java KeyStore
> file keystore.jks
keystore.jks : Java KeyStore
那么您的解决方案很容易重命名 keystore.jks
至APPNAME-release-key.keystore
.
关于android - 更改 Android React-Native 应用程序的上传 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62647304/