我希望为我的应用程序生成一个应用程序签名,以后将与Facebook集成。在Facebook的一个教程中,我发现了这个命令:

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

在教程中,它说通过运行这个cmd,我的生成签名的进程将开始。

但是,这个命令会给出一个错误:

openssl is not recognized as an internal or external command

我怎样才能摆脱这个?


当前回答

请遵循以下步骤,我希望你的钥匙工作正常:

Step 1 You will need OpenSSL. You can download the binary from openssl-for-windows project on Google Code. Step 2 Unzip the folder, then copy the path to the bin folder to the clipboard. For example, if the file is unzipped to the location C:\Users\gaurav\openssl-0.9.8k_WIN32, then copy the path C:\Users\gaurav\openssl-0.9.8k_WIN32\bin. Step 3 Add the path to your system environment path. After your PATH environment variable is set, open the cmd and type this command: C:\>keytool -exportcert -alias androiddebugkey -keystore [path to debug.keystore] | openssl sha1 -binary | openssl base64 Type your password when prompted. If the command works, then you will be shown a key.

其他回答

Steps to create Hash Key. 
1: Download openssl from Openssl for Windows . I downloaded the Win64 version 
2:Unzip and copy all the files in the bin folder including openssl.exe(All file of bin folder) 
3:Goto to the folder where you installed JDK for me it’s C:\Program Files\Java\jdk1.8.0_05\bin 
4:Paste all the files you copied from Openssl’s bin folder to the Jdk folder. 

然后进入C:\Program Files\Java\ jdk1.8.0_05\bin,按shift键,右键单击并打开cmd

C:\Program Files\Java\jdk1.8.0_05\bin>//cmd path 

这是给Sha1的 "C:\User\ABC\.android. keytool -exportcert -alias androiddebugkey -keystore "Keystore " | openssl sha1 -binary | openssl base64 . Keystore //和ABC是系统名放置自己的系统名

这种方法对我很有效。请更改您的路径

C:\Program Files\Java\jre7\bin keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Ace.android\debug. keystore "keystore" | "C:\openssl\bin

\openssl.exe" sha1 -二进制| "C:\openssl\bin\openssl.exe" base64

如果你在本地安装了git,很容易解决。 你可以打开git bash,在你想要生成密钥的地方更改目录,然后运行你的命令。 它将工作,因为git默认安装开放的SSL exe,你不需要每次你想运行SSL exe手动设置路径。 它对我很有效,我希望它能有所帮助。

在CMD下进入bin文件夹路径,然后执行以下命令

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

你将得到你的密钥散列

请遵循以下步骤,我希望你的钥匙工作正常:

Step 1 You will need OpenSSL. You can download the binary from openssl-for-windows project on Google Code. Step 2 Unzip the folder, then copy the path to the bin folder to the clipboard. For example, if the file is unzipped to the location C:\Users\gaurav\openssl-0.9.8k_WIN32, then copy the path C:\Users\gaurav\openssl-0.9.8k_WIN32\bin. Step 3 Add the path to your system environment path. After your PATH environment variable is set, open the cmd and type this command: C:\>keytool -exportcert -alias androiddebugkey -keystore [path to debug.keystore] | openssl sha1 -binary | openssl base64 Type your password when prompted. If the command works, then you will be shown a key.