How to solve "Key was created with errors:"
Asked Answered
C

5

17

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

I am getting this type of error with android studio 3.4 (32-bit version) at the time of generating the key, but when I am generating the same source code to apk in another laptop with android studio 3.4 (64-bit version). It works fine in 64-bit laptop and android studio.

enter image description here

Celtuce answered 20/5, 2019 at 6:31 Comment(0)
U
12

I encountered the same problem today and it seems that Android wants us to migrate our keys from the JKS proprietary format to the PKCS12 format (as shown in the warning). To do this, you need to use the keytool, which comes with Android Studio.

1. Locate keytool.exe

The keytool.exe is usually located in the folder C:\Program Files\Android\Android Studio\jre\bin. If you cannot find the keytool there, then you have to search for it.

2. Navigate to the jre folder with the Windows cmd

In Windows, open the cmd and type:

cd C:\Program Files\Android\Android Studio\jre\bin

Of course, if your keytool.exe is stored in another location, you need to enter the correct path after cd

3. Change the keystore format

In the cmd you already navigated to the folder containing the keytool.exe, so now you can enter the following command into the cmd:

keytool -importkeystore -srckeystore your_keystore_destination\your_keystore_file.jks -destkeystore your_keystore_destination\your_keystore_file.jks -deststoretype pkcs12

Don't forget to change

your_keystore_destination\your_keystore_file.jks

with your correct path. In your example it would be

D:\App Collection\App1 All in one Collection\keystorefile.jks

Note:

If you sepcified different passwords for the keystore and for the key, then you need to add -destkeypass your_key_password to the command in step 3!

Ulster answered 27/11, 2019 at 8:10 Comment(2)
Trying this I got a Warning: Succesfully migrated to a Non JKS/JCEKS. A security copy has been saved as: path\keyStoreFile.jks.old. Checking the new file is still a file.jks....Something possibly went wrong? or is this the expected result? I was expecting to see a file.pcks12....Thanks for sharing guys...Mcminn
Edit: Just try to replace the .jks extension with a .p12 extension on the 3rd step above, right on the second path (the one that will save your new file) and you'll receive a successfully imported message and a .p12 file...Thanks anyhow for sharing Leon, happy coding y'all...Mcminn
A
4

The following command worked for me on Mac while opening the terminal from the folder where your keyStore file is located:

keytool -importkeystore -srckeystore YOURKEYSTOREFILENAME -destkeystore YOURKEYSTOREFILENAME.p12 -srcstoretype JKS -deststoretype PKCS12
Astute answered 5/5, 2020 at 16:10 Comment(0)
H
2

I just ignored this error and used the key generated. I could upload my app without any difficulty.

Helbonia answered 5/3, 2021 at 14:33 Comment(0)
Y
2

When you navigate to Build > Generate Signed Bundle / APK and attempt to configure app signing for an app bundle or an APK, entering different passwords for the key and keystore may result in the following error:

Key was created with errors: Warning: Different store and Key passwords not supported for PKCS12 Key stores

To work around this issue, enter the same password for both the key and keystore.

Yuan answered 3/9, 2022 at 11:2 Comment(0)
E
1

To work around this issue, enter the same password for both the key and keystore.

Edsel answered 24/5, 2022 at 3:18 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Twitty

© 2022 - 2024 — McMap. All rights reserved.