I’m using Eclipse, and except for the default keystore path specified in windows->preferences->android->build, I didn’t specify any other customized keystore path in eclipse.
I have the debug.keystore in two locations. one is in the default path, and the other say c:\customised_path.
however, when i wanted to generate the cert:
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 20000
it’ll generate the debug.keystore in the java\bin folder.
and if i try:
C:\Java\jdk1.6.0_25\bin>keytool -genkey -v -keystore C:\default_path\.android\d
ebug.keystore
keytool error: java.io.IOException: Invalid keystore format
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:3
8)
at java.security.KeyStore.load(KeyStore.java:1185)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:620)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)
it’ll gimme the same error to generate the key in the customized path too.
i have debug.keystore in both folders still i’ll have this:
C:\Java\jdk1.6.0_25\bin>keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: C:\customiesed_path\.keystore
and
C:\Java\jdk1.6.0_25\bin>keytool -list -keystore C:\the_default_path_specified_in_eclipse.keystore
keytool error: java.lang.Exception: Keystore file does not exist: C:\default_path
Eclipse is using the .keystore in the default folder to sign the apk, and i have the .keystore in the default folder, but it just doesn’t allow me to sign it and gives me annoying error when I try to run my application.
Could somebody help here please?
Bingo! problem solved! it seems that the .keystore is somehow changed and after I re-download it, it works again.
I re-downloaded the .keystore that I need to use and run eclipse again. Now everything works normal. So next time someone has problems generating apk file using an existing key, please take into consideration “run” in eclipse not from cmd as well as download a new keystore.
One more thing: signing in debug mode is different from release mode! Eclipse uses “run” to sign in debug mode. Using command line won’t work because they’re simply for release.