Search code examples
androidxamaringoogle-apimono

Keystore file doesn't exist


I'm trying to get the SHA1 fingerprint so I can get an Google API key. Im in the following directory:

/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin

Then I execute the command from the google site :

keytool -list -v -keystore mystore.keystore

But it gives this error:

keytool error: java.lang.Exception: Keystore file does not exist: mystore.keystore
java.lang.Exception: Keystore file does not exist: mystore.keystore
    at sun.security.tools.keytool.Main.doCommands(Main.java:742)
    at sun.security.tools.keytool.Main.run(Main.java:340)
    at sun.security.tools.keytool.Main.main(Main.java:333)

I followed tutorials but I can't get it to work! Does anyone know what I am doing wrong?

BTW: I'm using a Macbook Pro with Xamarin Studio 5.5.2.


Solution

  • You said you are running the command from...

    /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin
    

    Is your keystore file in that directory as well? If not then you need to specify the path to the keystore file, e.g.

    keytool -list -v -keystore ~/somefolder/mystore.keystore
    

    The keystore used should be the one used to sign the app. For Xamarin debug builds this will be the debug keystore located at /Users/[USERNAME]/.local/share/Xamarin/Mono\ for\ Android/debug.keystore. The command on OSX for this would be...

    keytool -list -v -keystore /Users/[USERNAME]/.local/share/Xamarin/Mono\ for\ Android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    

    Or on Windows 7

    keytool -list -v -keystore C:\Users\[USERNAME]\AppData\Local\Xamarin\Mono for Android\debug.keystore -alias androiddebugkey -storepass android -keypass android