Warning: Different store and key passwords not supported for PKCS12 KeyStores. Ignoring user-specified -keypass value. in Android Studio

AndroidAndroid StudioAndroid Keystore

Android Problem Overview


I am trying to create a new Keystore to generate a signed apk but I am getting an error like this, please help me to get rid of this error.

enter image description here

enter image description here

Android Solutions


Solution 1 - Android

This is a known issue with Android Studio 4.2. It runs on JDK11 which has this limitation.

Google's own documentation on app signing states that the key password "should be different from the password you chose for your keystore" so I'm guessing they intend to fix this at some point.

Solution 2 - Android

The key store password and key password should be the same in order to avoid this error. However before I was able to release and deliver apps where key store password and key password are different and I still use it today when updating my apps. If anyone can point out what happened here or is this a part of update before and after the new Android Studio Arctic Fox please provide some source.

Solution 3 - Android

Android Studio Version 4.2 Update

Now Android Studio runs on JDK 11. Due to these changes, the signing keys issue is coming.

> Solution

Use the same password for both the Key and Keystore.

Solution 4 - Android

I got caught by this after upgrading to Android Studio 4.2 too.

One workaround I found is to first create the keystore file with the same password in Android Studio then switch to an old JDK (pre 11) and use the keytool command to update the key password.

  1. Find and use an old version of Java (Sorry assumes Mac or Linux but setting JAVA_HOME on Windows should work too.)
    $ /usr/libexec/java_home -V
    $ export JAVA_HOME=$(/usr/libexec/java_home -v OLD_VERSION)
    
  2. Run keytool to update your key password.
    $ keytool -keypasswd -keystore PATH_TO_KEY_STORE -alias ALIAS -storepass STORE_PASSWORD -keypass OLD_KEY_PASSWORD -new NEW_KEY_PASSWORD
    

Solution 5 - Android

I was very surprised when I entered the same with key password and password and got the right result. and jks file created successfully in android studio 4.2.

Solution 6 - Android

This issue occurred in android studio 4.2. it has the solution to solve this issue in android studio 4.0.

Follow the steps.

Click help menu in android studio, click Edit custom VM options, thi action response to open the file studio64.exe.vmoptions.

In this file add the below command line:

custom Android Studio #.vmoptions, see https://developer.android.com/studio/intro/studio-config.html

Or Upgrade latest version.

Note: to work around this issue, enter the same password for both the key and keystore.

Solution 7 - Android

All of these answers make it sound like this is a bug in latest Android Studio or keytool and all provide "workarounds". But using PKCS12 with same key/store password is the desired and correct behavior. See the comment from the linked bug filing

The only thing that is incorrect is Android's outdated doc to use separate PWs.

Solution 8 - Android

From JDK version 9 default key format is set to PKCS12 see link. To create key with different keystore and key passwords use keytool (note the -storetype JKS tag) and then choose that key you've created in Android Studio (during creation replace every string that starts with CHANGE_ in the example below):

keytool -genkey -v -alias CHANGE_KEY_ALIAS -keyalg RSA -keysize 2048 -validity 10000 -storetype JKS -dname "CN=CHANGE_FIRST_NAME_LAST_NAME,OU=IT,O=CHANGE_ORGANISATION_NAME,L=CHANGE_LOCATION_CITY_NAME,C=CHANGE_COUNTRY_CODE" -keystore CHANGE_KEYSTORE_NAME.keystore -keypass CHANGE_KEY_PASSWORD -storepass CHANGE_KEYSTORE_PASSWORD

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncreativecoderView Question on Stackoverflow
Solution 1 - Androidamram99View Answer on Stackoverflow
Solution 2 - AndroidMihae KheelView Answer on Stackoverflow
Solution 3 - AndroidVIISHRUT MAVANIIView Answer on Stackoverflow
Solution 4 - AndroidDaisuke ShimamotoView Answer on Stackoverflow
Solution 5 - Androidreza_khalafiView Answer on Stackoverflow
Solution 6 - AndroidKumareshView Answer on Stackoverflow
Solution 7 - Androidtir38View Answer on Stackoverflow
Solution 8 - AndroidkhashashinView Answer on Stackoverflow