problem in cmd prompt for getting MD5 fingerprint in android - android

Having overcome my earlier problem, I am still having difficulty generating an MD5 fingerprint for Android from the command line. Can anybody tell me what I'm doing wrong?
Command line:
C:\Program Files\Java\jdk1.6.0\bin>keytool.exe -list -alias androiddebugkey -keystore C:\Documents and Settings\Saurabh.android\debug.keystore -storepass android -keypass android
Error:
**Illegal option: -key
Try keytool -help**

It's probably that you mistyped the path. I guess your command should look like
C:\Program Files\Java\jdk1.6.0\bin>keytool.exe -list -alias androiddebugkey -keystore "C:\Documents and Settings\Saurabh\.android\debug.keystore" -storepass android -keypass android
The difference is in the slash before .android\debug.keystore and the quotes around the path containing spaces.

Same problem. I couldn't get MD5 key in JDK1.7 (Keytool on JDK 1.7 always return SHA1 key) . I removed JDK 1.7 then installed JDK 1.6, the problem wasn't exist any more.

Related

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.
Linux & Mac command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Will give you SHA1, SHA256, MD5 for default debug key. And it can be used for developing and debugging with google play services.
For publication certificate just follow https://developer.android.com/studio/publish/app-signing.html
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
I faced the same issue, but resolved via following command:
keytool -exportcert -keystore C:\Users\<USERNAME>\.android\debug.keystore -list -v
OS: Windows 7
I have windows 10, I went to the route
c:/Users/usuario/.android/
Inside directory, execute command:
keytool -exportcert -keystore debug.keystore -list -v
Must generate fingerprint:
SHA-1: 73:BE:1A:.......................
MDO: 73:BE:A1.........................
SHA-256: 3B:B8:98:...................
Please provide the complete path of debug.keystore.
Example: C:/Users/myusername/.android/debug.keystore instead of ~/.android/debug.keystore
In my case the debug.keystore is generated after the first run of the app on Android Studio
I had the same issue.
My error was
keytool error: java.lang.Exception: Keystore file does not exist:/Users/[USER_NAME]/.android/debug.keystore java.lang.Exception: Keystore
file does not exist: /Users/[USER_NAME]/.android/debug.keystore
at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:910)
at java.base/sun.security.tools.keytool.Main.run(Main.java:416)
at java.base/sun.security.tools.keytool.Main.main(Main.java:409)
I checked my /Users/[USER_NAME]/.android/ directory and I couldn't find debug.keystore file there.
Reason:
I used VSCODE and I did run my application only for iOS through iOS Simulator.
Solution:
I opened Android Studio and run my application for android with Android Emulator.
Then I got debug.keystore file in my .android/ directory.
Then I tried command below again:
keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
And it runs without any error.
I hope it helps you.
I had the same error in Windows 10 as well. But sorted it and finally got SHA-1 Key.
I followed these steps
1.Open C drive and follow this path C:\Program Files\Java\jdk1.8.0_201\bin .
2.Inside bin folder open CMD and run command keytool -exportcert -list -v -alias androiddebugkey -keystore C:/Users/Username/.android/debug.keystore . (Replace Username with your username).
3.Enter password as android .
Linux or Mac or Windows, use complete path
Mac:
keytool -list -v -keystore /Users/username/.android/debug.keystore
-alias androiddebugkey -storepass android -keypass android
Linux (Ubuntu in my case):
keytool -list -v -keystore /home/username/.android/debug.keystore
-alias androiddebugkey -storepass android -keypass android
Windows:
keytool -list -v -keystore C:\Users\username\.android\debug.keystore
-alias androiddebugkey -storepass android -keypass android
Hope it work for you!
I found this guide from teamtreehouse forum. hope it'll help you.
1) Open Command Prompt by pressing Start+R and typing cmd.exe.
2) Using Windows Explorer, find where your JDK directory is located (Usually Program Files >> Java) and copy the path.
3) In Command Prompt, type cd followed by the directory of your JDK’s bin directory. e.g: cd C:\Program Files\Java\jdk1.8.0_25\bin is the command I use (Yours may vary).
4) Using Windows Explorer, find where your .android directory is located (Usually under Users >> [YOUR WINDOWS USERNAME]) and copy the path.
5) Now, use this command below:
keytool -exportcert -alias androiddebugkey -keystore[PATH_TO_.ANDROID_DIRECTORY] -list -v
Replacing [PATH_TO_.ANDROID_DIRECTORY] with the path you copied. Note that you should be running this command in terminal/command prompt in your JDK’s bin directory (You did this in Step 3).
Mine is C:\Program Files\Java\jdk1.8.0_121\bin>keytool -exportcert -alias androiddebugkey -keystore C:\Users\HoSiLuan\.android\debug.keystore -list -v
Remember to use C:\Users\HoSiLuan\.android\debug.keystore instead of ~/.android\debug.keystore. I still got the error when type this shorten way.
You should then be prompted with the password as normal which you can enter (The password is android) . After that, you’ll see the list of certificates printed to the screen.
If you are on Windows open command prompt and RUN AS ADMINISTRATOR then paste the line keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore. That should work, it worked for me
I lived same problem on Windows 10 and solved that problem with writing below command:
keytool -list -keystore debug.keystore
I think with some other commands java couldn't find debug.keystore file but interestingly with that command it works for me.
I had the same Error
am using ubuntu 18.04
Solution:
Open terminal and navigate to /home/{$user}/.android
Then run the command
keytool -list -v \ -alias androiddebugkey -keystore ~/.android/debug.keystore
You will be prompted to enter a keystore password enter android
Hope this helps.
Below command should work:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
So I have found the solution.
On Windows, open cmd from start menu and write cd C:\Users\put_here_your_username\.android and then write
keytool -list -v -keystore ".\debug.keystore" -alias androiddebugkey -storepass android -keypass android
last update for Mac & Ubuntu
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
I faced the same problem, I found that I had .android folder inside another .android folder. Make sure to find the right path of debug.keystore file on your system
I used this command and it worked
keytool -list -v -alias androiddebugkey -keystore C:\Users\User.android.android\debug.keystore
keytool -list -v -keystore C:\Users\%USERNAME%\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
Try this to get resolve from the problem
If you are on Windows open command prompt and then Run it as an administration then paste this: keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%.android\debug.keystore
use password : android
then you will get SHA-1 and SHA-256 this worked smoothly for me.
Install keytool on your system
Keytool is included as part of the Java runtime. So by installing Java, you'll also have keytool in your system.
To install Java, visit the JAVA SE Downloads page. Then, select the JDK Download link.
After that, add the keytool folder to your system %PATH% (on Windows). In order to run keytool from the command line, you need to add it to your system PATH. This step is required on Windows only.
Finally, run this command in a terminal, and don't forget to change the user name to your own:
keytool -list -v -keystore "c:\users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Open CMD and navigate to Java bin folder for example:
C:\Program Files\Java\jre1.8.0_341\bin
Once you stand here then paste this:
keytool -exportcert -list -v -alias androiddebugkey -keystore C:/Users/*YOUR_PC_USERNAME*/.android/debug.keystore
Do not forget to change to your own PC username marked with * YOUR_PC_USERNAME *
Double check that you are putting the correct address in my case I had two typos and that fixed it.
I had c:User instead of C:\Users\
Find your debug.keystore file by searching (usually it is in .android) and then use this
keytool -list -v -alias androiddebugkey -keystore "C:\Users\u_name\ .android\debug.keystore"
Use your own full path name not copy paste from anywhere.
It solved mine and this or some else solution will solve yours too😄.
just put this given command in your package.json file and hit run yarn sha-keys
"sha-keys": "keytool -list -v -keystore ./android/App/debug.keystore -alias androiddebugkey -storepass android -keypass android",

can't get google maps api key

I have windows 7 and it seems that I can't get api key ! I've tried so much !
I opened the cmd and entered:
keytool -list -alias androiddebugkey -keystore D:\avd\.android\debug.keystore -storepass android -keypass android
and yet it says to me:
'keytool' is not recognized as an internal or external command, operable
program or batch file.
I've also tried like that:
"C:\Program Files\Java\jdk1.7.0_07\bin\java.exe" keytool -list -alias androiddebugkey -keystore D:\avd\.android\debug.keystore -storepass android -keypass android
and it says:
Could not find or load main class keytool
hope someone can help me I am very Desperate for an answer !
The dollar sign is not part of what you need to paste into your terminal. You should start with keytool on forward. In the example the dollar sign is showing the beginning of the prompt (which is how it looks on Unix/Mac terminals).
keytool is an executable that is part of the Java SDK. The location of the bin file must either be added to your terminal's path or you have to run it using the full path to the file. Typically, on Windows the Java binaries are located at C:\Program Files\Java\jdk1.7.0_07\bin or something similar. You were close with your second guess in this case, but keytool is not a command you pass to java.exe...it is an executable itself in the same directory.
HTH
Try this
C:\Program Files\Java\jdk1.7.0_07\bin\keytool -v -list -alias androiddebugkey -keystore D:\avd\.android\debug.keystore -storepass android -keypass android
or
Just copy the debug.keystore file to the same folder as keytool and execute the below in command prompt
keytool -v -list -alias androiddebugkey -keystore D:\avd\.android\debug.keystore -storepass android -keypass android
Those are the steps through the Command Prompt that worked for me :
cd C:\Program Files\Java\jdk1.8.0_05\bin keytool -list -alias
androiddebugkey -keystore C:\Users\ {username}.android\debug.keystore
-storepass android -keypass android

Map API Key for Windows 7

I'm trying to generate and MD5 certificate for my Map API Key for Debugging, the problem is, when I type this :
$ keytool -list -alias alias_name -keystore my-release-key.keystore
into the Command prompt, it says '$'is not recognized as an internal or external command, operable command or batch file.
Is this because I'm using Windows 7?
Also, there are no explicit instructions on the Dev guide for generating API Key on Windows 7.
With JDK 1.7 installed, keytool always outputs by default SHA1 fingerprint, not MD5. you can get the MD5 Certificate by adding -v option.
use the following code:-
C:\Program Files\Java\jdk1.7.0\bin>keytool -v -list -alias
androiddebugkey -keystore debug.keystore -storepass android -keypass android
it will output MD5 certificate as well.

Error in cmd prompt for getting MD5 fingerprint

I want to get MD5 finger print in Android for google map, but when I try to run it in a command window it shows the message below. How do I overcome this problem?
Command Line:
C:\>C:\Program Files\Java\jre6\bin>keytool.exe -list -alias androiddebugkey -key
store C:\Documents and Settings\Saurabh\.android\debug.keystore -storepass andro
id -keypass android
Error:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Use
C:>cd C:\Program Files\Java\jre6\bin
first and then from bin, execute the ketool.exe
the command for it is:
keytool -list -alias androiddebugkey -key store C:\Documents and Settings\Saurabh.android\debug.keystore -storepass andro id -keypass android
use this simple command
keytool -list -keystore "C:\Documents and Settings\Saurabh.android\debug.keystore"..
Thats it.. Enter twice..
Check whether the path C:\Documents and Settings\Saurabh contains a folder .android. If not, choose the path that contains .android ( if you dont know where, then if you are using eclipse, go to Window->Preferences->Android->Build and check Default debug keystore path and give that instead of C:\Documents and Settings\Saurabh.android\debug.keystore
running the following code should get you the MD5 fingerprint if you are giving the right debug keystore path... note that there is a '\' before .android which you had missed in the previous posts
C:\Program Files\Java\jre6\bin>keytool -list -alias androiddebugkey -keystore C:\Documents and Settings\Saurabh.android\debug.keystore -storepass andro id -keypass android

Error in Keytool command

hi when i try to run this command bin/keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android
i got the error java.lang.Exception Keystore file doesnot exist :debug.keyStore
actually i am trying to get googlemaps key for android never used keytool command.
can any one help how to remove this error
The problem is that the keytool does not know where to look for the keystore file.
If you're on Windows 7 / Vista, try:
keytool -list -alias androiddebugkey -keystore c:\users\your-user-name\.android\debug.keystore -storepass android -keypass android
(replace your-user-name with your actual user name)
For Windows XP, try:
keytool -list -alias androiddebugkey -keystore c:\documents and settings\your-user-name\.android\debug.keystore -storepass android -keypass android
If V2 map to generate SHA key use this command. use for releasing key means for testing.
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -list -v -alias androiddebugkey -keystore C:\Users\DON\.android\debug.keystore -storepass android -keypass android
Don is usersystem name
If you want app live means for development.
eclipse->Window ->Preferences ->Android ->Build -> now you get the sha key
Finally i solve the problem and the correct working script / Command is below:
Please note the double quotes where they are placed please use as it is as this is the correct method. and off course please change the user name and as for the different versions of windows you people will have to change it accordingly. Please feel free to ask if you people have any questions.
C:\Program Files\Java\jdk1.6.0_25\bin>keytool -list -alias androiddebugkey -keys
tore "c:\documents and settings\user\.android\debug.keystore" -storepass android
-keypass android

Categories

Resources