我希望为我的应用程序生成一个应用程序签名,以后将与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

我怎样才能摆脱这个?


当前回答

不能保证用这个单独的openssl方法生成hashkey就能正常工作。 如果对我没用的话。但是谢谢你给了我解决问题的方向。

保证解决方案: 您需要将整个命令分解为单独的命令,并且必须将每次执行的输出写入文件。

您可以从以下链接获取帮助:

http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1

享受:)

其他回答

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

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.

IDK如果这是相关的,但如果你已经安装了Git,你可以在“C:\Program Files\Git\usr\bin”中找到openssl,这个位置你可以在终端中使用你的密钥库命令。

哦,对了,命令:

"C:\Users\YOURPATH/filename. exe -exportcert -alias keystore -keystore "C:\Program Files\Git\usr\bin\openssl" base64 . jks" | "C:\Program Files\Git\usr\bin\openssl" sha1 -二进制|

这对我来说很成功。

“C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe” -exportcert -alias sociallist -keystore “D:\keystore\SocialListing” |“C:\cygwin\bin\openssl.exe” sha1 -binary |“C:\cygwin\bin\openssl.exe” base64

注意以下路径:

“C: \ Program Files \ Java \ jdk1.6.0_26 \ bin \ keytool.exe” “D:\keystore\SocialListing”或者可以是这样的“C:\Users\Shaon.android\debug.keystore” “C:\cygwin\bin\openssl.exe”或者可以像这样:C:\ users \openssl\bin\openssl.exe

如果命令成功工作,那么你将看到这个命令:

输入keystore密码:typeyourpassword

Encryptedhashkey * *

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

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

你将得到你的密钥散列

我今天也遇到了同样的问题,通过以下视频(SSL安装)解决了它- https://www.youtube.com/watch?v=PoAc1lpfK8I&ab_channel=GleyGames

然后,我使用Usamas命令,并运行它(在命令中更改路径后),我从java安装中的bin文件夹中运行它,使用CMD。

对我有效的全面命令:

(来自C:\Program Files\Java\ jdk-11.0.12\bin):

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "C:\Program Files\OpenSSL-Win64\bin\openssl" sha1 -binary | "C:\Program Files\OpenSSL-Win64\bin\openssl" base64