javalang.exception:key pair not generated, alias <androiddebugkey> already exists and java.io.filenotfoundexception:debug.keystore

19,415

Solution 1

Found out that you need to delete the existing debug.keystore before generating a new debug.keystore. When generating a new debug.keystore, you need to list the directory where you want to store the keystore file.

After delete the old debug keystore, enter the below command in android studio terminal:

keytool -genkey -v -keystore debug.keystore C:\Users\abc\.android\debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

Where debug.keystore is the name you want to define your keystore file, C:\Users\abc\.android\debug.keystore is the directory where you want to store the keystore

Solution 2

Based on a suggestion from others, I actually deleted debug.keystore, hence the file not found exception

Below worked:
- Retrieved debug.keystore back form recycle bin
- Reverted to old keys, instead of new upload keys. The old key was generated using android studio.

Reverted to old key is because play console rejected the upload of new app release as an update to older one.

Share:
19,415
Jason Chen Ming
Author by

Jason Chen Ming

Updated on June 14, 2022

Comments

  • Jason Chen Ming
    Jason Chen Ming about 2 years

    I enter the following

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

    in cmd to generate debug keytool.

    However, I received the error

    java.io.filenotfoundexception:debug.keystore" instead. Afterwhich I changed the above command to "keytool -genkey -v -keystore C:\Users\me.android\debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

    And this time I received another error

    javalang.exception:key pair not generated, alias already exists

    What goes wrong here? What I am trying to do here is just to generate a new debug keystore.