16

I am trying to find my keytool so that I can make keys to sign my app and to register for the google maps api

I'm beginning to think that I don't actually have it on my machine

If anyone could help point me in the right direction that would be great

Trott
  • 66,479
  • 23
  • 173
  • 212
Ian
  • 1,490
  • 6
  • 24
  • 39

6 Answers6

32

To answer the original question, on my Mac, keytool is found at /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/keytool.

You can locate the Java home directory using the /usr/libexec/java_home command line tool on Mac OS X 10.5 or later.

Sufian
  • 6,405
  • 16
  • 66
  • 120
Reefwing
  • 2,242
  • 1
  • 22
  • 23
  • 2
    Important to note that [if you do not have Java installed you will get the following output `Unable to find any JVMs matching version "(null)".`](https://discussions.apple.com/thread/3879451) – T.Woody Sep 08 '18 at 20:21
8

The actual tool should be installed all ready, as to my knowledge it ships with the MAC. You then have to create the .keystore file http://www.androiddevelopment.org/tag/keytool/ shows how to do it

Armand
  • 9,847
  • 9
  • 42
  • 75
8

If you are using Eclipse under Mac OS X you just need to
Select File -> Export -> select Android -> Export Android Application -> click next -> select your project -> click next -> here you just chose Create new keystore

DonGru
  • 13,532
  • 8
  • 45
  • 55
  • Actually this has only solved my issue in part. I now need to find my MD5 fingerprint, The guide on the android developers site says that I need to execute this line: $ keytool -list -alias alias_name -keystore my-release-key.keystore but there is now ".keystore" file in the folder that I specified when creating the keystore by your method, does this file get created in another folder? – Ian Sep 05 '11 at 09:54
7

If you already have android studio installed, then keytool is located at

/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool

example to generate sha1 and sha256 using keytool

/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Mahesh Jamdade
  • 17,235
  • 8
  • 110
  • 131
1

I did the following and it worked for me:

  1. /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/keytool -genkey -v -keystore my-release-key.keystore -alias my_keystone -keyalg RSA -keysize 2048 -validity 10000
  2. jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA1 -keystore my-release-key.keystore app-release-unsigned.apk my_keystone
  3. /Users/developer/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 app-release-unsigned.apk nameapp.apk
Adrian W
  • 4,563
  • 11
  • 38
  • 52
0

Simply use your keytool command in Android Studio Terminal for Mac with a random password

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

you will get -

ga0RGNYHvrrrrrrMMPWQWAPGJ8=

Akash kumar
  • 981
  • 3
  • 14
  • 27