问题
I am reading an development guide of Facebook Developers at here
It says that I must use keytool to export the signature for my app such as:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
I do not know how to find the keytool in order to run it. I tried to open a Windows command prompt and paste the above command, but it did not work.
回答1:
I found a solution by myself as below quote. It works fine.
"C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe" -exportcert -alias sociallisting -keystore "D:\keystore\SocialListing" | "C:\cygwin\bin\openssl.exe" sha1 -binary | "C:\cygwin\bin\openssl.exe" base64
回答2:
Simply enter these into Windows command prompt.
cd C:\Program Files\Java\jdk1.7.0_09\bin
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName\.android\debug.keystore" -list -v
The base password is android
You will be presented with the MD5
, SHA1
, and SHA256
keys; Choose the one you need.
回答3:
To get android key hash code follow these steps (for facebook apps)
- Download the openssl for windows here
- now unzip to c drive
- open cmd prompt
- type
cd C:\Program Files\Java\jdk1.6.0_26\bin
- then type only
keytool -export -alias myAlias -keystore C:\Users\<your user name>\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
- Done
To get Certificate fingerprint(MD5) code follow these steps
- go to - C:\Program Files\Java\jdk1.6.0_26\bin
- inside the bin folder run the
jarsigner.exe
file - open cmd prompt
- type
cd C:\Program Files\Java\jdk1.6.0_26\bin
- then again type on cmd
keytool -list -keystore "C:/Documents and Settings/<your user name>/.android/debug.keystore"
- it will ask for Keystore password now. The default is "
android
" type and enter - Done.
回答4:
keytool is part of the JDK.
Try to prepend %{JAVA_HOME}\
to the exec statement or c:\{path to jdk}\bin
.
回答5:
The KeyTool is part of the JDK. You'll find it, assuming you installed the JDK with default settings, in $JAVA_HOME/bin
回答6:
Robby Pond
's answer can be generalized to use JAVA_HOME
environment variable and to also compensate for any blanks that might occur in the path (like Program Files
):
"%JAVA_HOME%\bin\keytool" -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
回答7:
keytool is part of jdk, it should be $JAVA_HOME/bin/keytool
回答8:
Keytool is part of the Java SDK. You should be able to find it in your Java SDK directory e.g. C:\Program Files\Java\jdk1.6.0_14\bin
回答9:
On cmd window (need to run as Administrator),
cd %JAVA_HOME%
only works if you have set up your system environment variable JAVA_HOME . To set up your system variable for your path, you can do this
setx %JAVA_HOME% C:\Java\jdk1.8.0_121\
Then, you can type
cd c:\Java\jdk1.8.0_121\bin
or
cd %JAVA_HOME%\bin
Then, execute any commands provided by JAVA jdk's, such as
keytool -genkey -v -keystore myapp.keystore -alias myapp
You just have to answer the questions (equivalent to typing the values on cmd line) after hitting enter! The key would be generated
回答10:
Android: where to run keytool command in android
Keytool command can be run at your dos command prompt, if JRE has been set in your classpath variable.
For example, if you want to get the MD5 Fingerprint of the SDK Debug Certificate for android,
just run the following command...
C:\Documents and Settings\user\.android> keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android
where C:\Documents and Settings\user\.android>
is the path which contains the debug.keystore
that has to be certified.
For detailed information, please visit http://code.google.com/android/add-ons/google-apis/mapkey.html#getdebugfingerprint
回答11:
Depending on your version of Eclipse ( I am using Kepler). Go to Windows> Preferences>Android> Build.
You'll find the location path of your debug keystore as well as the SHA1 fingerprint (which you can just copy and use)
回答12:
keytool is located in JDK bin directory ($JAVA_HOME/bin). JAVA_HOME is your JDK installation directory. To use that command line you should also include $JAVA_HOME/bin to your PATH environment variable.
回答13:
KEYTOOL is in JAVAC SDK .So you must find it in inside the directory that contaijns javac
回答14:
keytool
comes with the JDK. If you are using cygwin then this is probably on your path already. Otherwise, you might dig around in your JDK's bin folder.
You'll probably need to use cygwin anyways for the shell pipes (|
) to work.
回答15:
Few observations while I was getting the same problem (Windows). 1. Shell pipe is important. 2. If you are using OpenSSL or Cygwin, definitely you have to install it. 3. keytool comes with JDK so either you have to point to it in the command or you have cd to the JDK/bin folder (where the exe resides) 4. The debug keystore is typically located at ~/.android/debug.keystore 5. password is "android" whether you -keypass it or type it when prompted. 6. For the alias name, you can open (DO NOT SAVE, just open and close) the keystore file with any editor and read it. 7. MOST IMPORTANT - There is a difference is specifying the keystore path within quotes and without. I got it working by using the keystore path within the double quotes. As remix090378 said and as per the instruction, this command indeed worked - cd C:\Program Files\Java\jdk1.7.0_09\bin
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName.android\debug.keystore" -list -v
来源:https://stackoverflow.com/questions/5488339/how-can-i-find-and-run-the-keytool