我希望为我的应用程序生成一个应用程序签名,以后将与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
我怎样才能摆脱这个?
步骤1
从https://code.google.com/archive/p/openssl-for-windows/downloads下载用于windows的SSL。
步骤2
解压文件夹到OpenSSL,并粘贴到“C:\Program Files”。
步骤3
在环境变量中添加“C:\Program Files\OpenSSL\bin”(编辑系统环境变量>环境变量> Path > New)。它将使openssl在终端中工作。
步骤4
将“C:\Program Files\Android\Android Studio\jre\bin”添加到环境变量中。它将使keytool在终端中工作。
步骤5
打开一个终端并执行:
keytool -exportcert -alias androiddebugkey -keystore .android\debug.keystore | openssl sha1 -binary | openssl base64
密码应该是android。
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是系统名放置自己的系统名