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

5

9

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.

Hoatzin answered 16/8, 2017 at 16:48 Comment(1)
anyone any comments or helps?Hoatzin
H
15

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

Hoatzin answered 19/8, 2017 at 10:21 Comment(2)
im already deleted this debug.keystore but when i run the command .\keytool -genkey -v -keystore debug.keystore C:\Users\jit\.android\debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 i got this Illegal option: C:\Users\jit\.android\debug.keystore keytool -genkeypair [OPTION]... Generates a key pairNecolenecro
and he lists all of the optionsNecolenecro
S
1

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.

Settling answered 4/3, 2019 at 10:12 Comment(0)
B
0

when you creating next app (you always created one)there was alwasys upload-keystore.jks .so first you have to delete that. then paste your code in terminal

On Mac/Linux, use the following command:

content_copy

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload

On Windows, use the following command:

content_copy

keytool -genkey -v -keystore c:\Users\USER_NAME\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Bagwell answered 20/10, 2021 at 0:2 Comment(0)
M
0

I encountered this error and what I had to do was to delete the upload-keystore.JKS file from the original path given when creating it the first time and the project itself. For me, I had to delete it from

  1. My Project in Android studio

    android/app folder

And also, from my computer

/Users/bojack folder

A better and easier way is create a folder where to store the file, then add the path just after "-keystore" key word

Mairemaise answered 25/3, 2022 at 11:27 Comment(0)
P
0

Problem: I encountered a persistent error after changing the signing configuration to debug mode in my Flutter project.

Solution: To resolve this issue, I modified the build.gradle file to include the correct signing configuration and updated the project directory name along with the path to the .jks file.

Here are the steps I took:

  1. Open the android/app/build.gradle file in your Flutter project.

  2. In the buildTypes section, ensure that the release configuration uses the correct signing configuration:

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
    
  3. Make sure to update the keyAlias, keyPassword, storeFile, and storePassword values with your actual keystore properties.

  4. Update the storeFile path to reflect the new directory name if you've changed it:

    storePassword=<your_store_password>
    keyPassword=<your_key_password>
    keyAlias=upload
    storeFile=<your_path_to_new_directory/your_upload-keystore.jks>
    

Replace <your_store_password>, <your_key_password>, and <your_path_to_new_directory> with your actual values.

By following these steps, you should be able to resolve the error caused by incorrect signing configurations in your Flutter project.


Make sure to replace placeholders like <your_store_password>, <your_key_password>, <your_path_to_new_directory>, and <your_upload-keystore.jks> with your actual values.

Participial answered 13/4 at 13:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.