Sign android apk with existing .keystore

I am using Eclipse, and with the exception of the default repository path specified in windows-> preferences-> android-> build, I did not specify any other custom cache path in eclipse.

I have debug.keystore in two places. one is by default and the other is c: \ customized_path. however, when I wanted to generate a certificate:

keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 20000 it will generate 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 will give the same error to generate the key in a custom path.

I have debug.keystore in both folders, but I will have the following:

 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 Error keytool: java.lang.Exception: Keystore file does not exist: C: \ default_path

Eclipse uses .keystore in the default folder to sign apk, and I have .keystore in the default folder, but it just doesn't let me sign it and causes an annoying error when I try to run my expression.

Can someone help here please?

+4
source share
1 answer

Bingo! the problem is solved! it seems that .keystore is somehow changed, and after I reload it, it works again.

I reloaded .keystore, which I need to use and run eclipse again. Now everything is working fine. Therefore, the next time someone has problems creating an apk file using an existing key, consider "run" in eclipse, not from cmd, and also download a new keystore.

One more thing: entering debug mode is different from release mode! Eclipse uses "run" to enter debug mode. Using the command line will not work because they are just for release.

0
source

Source: https://habr.com/ru/post/1387606/


All Articles