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?