'Invalid Keystore Format while signing the react native app

I have developed a react native application. I am trying to push it to google playstore. I am following the same steps mentioned in react native official doc https://reactnative.dev/docs/signed-apk-android, and generated a kestore file called wings-prod.keystore file.

When I try signing the app using ./gradlew signingReport I am getting Invalid keystore format format. Can someone help with this?

Error: Failed to read key wings-prod from store "/Users/asrinivasarao/Projects/winggs-app/winggs-customer/winggs/android/app/wings-prod.keystore": Invalid keystore format


Solution 1:[1]

Try:

The command for generating a keystore file is ( Remember to run this command in the android/app directory, atleast if you are on a mac.)

keytool -genkey -v -keystore release.keystore -storepass android -alias androidreleasekey -keypass android -keyalg RSA -keysize 2048 -validity 10000

On Windows: The keytool must be run from C:\Program Files\Java\jdkx.x.x_x\bin

Follow the official guide

Also, keep in mind that it should be the same key, if you have already published the app to the play store.

If any of the above does not work:

  1. try deleting the .gradle file and running the
./gradlew clean
  1. Check the Java Version if it is the same at
D:\Program Files\Java\

and

D:\Program Files\Android\Android Studio\jre

Additionally check if you are running on JDK11 if you are on react native 0.65 and above.

Solution 2:[2]

I ran into this same problem today in my React-Native app. The solution was to upgrade my JDK version from 8 to 11. Android Studio > Preferences > Build Execution Deployment > Build Tools > Gradle. Select (or download then select) Gradle JDK version corretto-11.

To give proper credit, I was tipped off to this solution here: https://stackoverflow.com/a/69270811/5788142

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abhishek Sah
Solution 2 topherPedersen