We had to reset our Android Upload key for a React-Native Android Application. We contacted Google to reset the key.
Google asked us to complete the following steps: Here’s how to generate and register a new upload key:
Follow the instructions in the Android Studio Help Center to generate a new key. It must be different from any previous keys. Alternatively, you can use the following command line to generate a new key:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
This key must be a 2048 bit RSA key and have 25-year validity. Export the certificate for that key to PEM format:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Reply to this email and attach the upload_certificate.pem file.
Further Steps
We now have the generated files, keystore.jks
and an upload_certificate.pem
file.
Previously our application used a '***-release-key.keystore' file to upload.
Build Process
gradle.properties file
MYAPP_RELEASE_STORE_FILE=APPNAME-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=APPNAMEapprelease
build.gradle file
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")
Notes
We use fastlane to deploy the application. How do we get/change the .keystore file with the new files we have?
The documentation casually tends to refer to .jks
files as .keystore
in some places. They are the same format.
Check for yourself:
file APPNAME-release-key.keystore
APPNAME-release-key.keystore : Java KeyStore
> file keystore.jks
keystore.jks : Java KeyStore
Then your solution is simple to rename keystore.jks
to APPNAME-release-key.keystore
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With