0

I want to generate a sha-1 so I can use the google maps v2 in my android app, im using oracles java jdk1.77.025 on ubuntu-mint. I get the following error:

marko@marko-K39a2 /usr/local/java/jdk1.7.0_25/bin $ keytool -list -v -alias androiddebugkey -keystore /home/marko/.android/debug.keystore -storepass android -keypass android list: unrecognized option '-keypass' list: Try 'list -help' for more information 

this is very strange since I have build a key before and I never had problems. Thanks

3 Answers 3

1

if you put this somewehere in your app it will print it for you:

 try { PackageInfo info = getPackageManager().getPackageInfo("my.package.name", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md; md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); String something = new String(Base64.encode(md.digest(), 0)); //String something = new String(Base64.encodeBytes(md.digest())); Log.e("hash key", something); } } catch (NameNotFoundException e1) { Log.e("name not found", e1.toString()); } catch (NoSuchAlgorithmException e) { Log.e("no such an algorithm", e.toString()); } catch (Exception e) { Log.e("exception", e.toString()); } 
Sign up to request clarification or add additional context in comments.

1 Comment

this worked, thanks, but i was hopping for a console solution, since i ahve a problem getting it from the console. Thanks for the answer
0

try to use this

keytool -list -v -keystore /home/marko/.android/debug.keystore 

just skip the -alias and -keypass attribute use only this main attribute

4 Comments

Enter key store password: android keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
Im asked for a password and when I enter android the default debug password i get: keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
Im asked for a pass, after putting: keytool -list -v -keystore /home/marko/.android/debug.keystore
Yes I am saying about this that after execute this cmd, it will prompt you for password then just enter press no need to provide password for this right now. When you pass -keypass or -storepass then only you need to provide same password after execute keytool cmd
0

Run the following command to get your sha1: keytool -v -list -keystore "< debug.keystore path >" . check your debug.keystore path by windows-->preferences-->android-->build.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.