Woona
Woona

Reputation: 15

How to generate a signed apk with keystore type JCEKS generated from Terminal?

Used the below command to generate the keystore file:

Keytool -genkey -v -keystore trial.keystore -storetype jceks -alias trial -keyalg RSA -keysize 2048 -validity 10000 -keypass 260720 -storepass 260720

Terminal output :

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days for: CN=input, OU=input, O=input, L=input, ST=input, C=input [Storing trial.keystore]

Warning: The JCEKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore trial.keystore -destkeystore trial.keystore -deststoretype pkcs12".

Keystore file generated but unable to generate signd apk with the same keystore.

Error : Invalid keystore format

Build Output :

FAILURE: Build failed with an exception.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Failed to read key trial from store "/Downloads/trial.keystore": Invalid keystore format

BUILD FAILED in 1s 29 actionable tasks: 1 executed, 28 up-to-date

Upvotes: 0

Views: 410

Answers (1)

Sivasankar chimata
Sivasankar chimata

Reputation: 341

For android:Terminal Command use this below command:

keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 10000 -keystore keystore.jks

OR

For React-Native use below command :

keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

Upvotes: 0

Related Questions