2

I have an Android app certificate with a file type of FILE that was created back in 2012 for my Android app written in Java. Now I have updated that app using React Native.

How can I use the existing certificate to generate keystore and sign my updated app to be released on Google Play?

I've tried this even though the React Native certificate extension is .keystore

keytool -importcert -file "your.cer" -keystore your.jks -alias "<anything>"

and I got the following error

keytool error: java.lang.Exception: Input not an X.509 certificate

I expect to have a .keystore file that allows me to release an update of my existing Android app.

2 Answers 2

4

You don't need to create keystore file. you can use existing jks file to sign the app. Do as follow:

  • Put your jks file in the app directory
  • add the following code in your gradle.poperties file.

    MYAPP_RELEASE_STORE_FILE=filename.jks
    MYAPP_RELEASE_KEY_ALIAS=your-key-alias
    MYAPP_RELEASE_STORE_PASSWORD=your-store-password
    MYAPP_RELEASE_KEY_PASSWORD=your-release-key-password
    
  • Now add the signingConfigs in build.gradle file as below:

    signingConfigs{
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
    
  • Now you can sing your using your existing jks file.

Sign up to request clarification or add additional context in comments.

6 Comments

My certificate's file type is FILE how can I convert it to jks ?
just add yourfilename.jks and try to build it will work.
You can check the certificate details after apk signed using this command : unzip -p Name-of-apk.apk META-INF/CERT.RSA | keytool -printcert
I've followed all the steps but I could not find the release folder (ie. no generated apk) at ...\android\app\build\outputs\apk
@GirmaFeyissa is your build successful?
|
2

One thing missed from the accepted answer.

How to fetch the existing Keystore file from the expo?

expo fetch:android:keystore

I need to know this so hopefully, it'll help someone.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.