我正在这里阅读Facebook开发者的开发指南

它说,我必须使用keytool导出签名为我的应用程序,如:

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

我不知道如何找到关键工具,以运行它。我试图打开Windows命令提示符并粘贴上述命令,但它不起作用。


当前回答

在我的例子中,我已经使用ionic cordova build android——prod命令生成了一个APK文件,我需要为已经存在的APK文件获取SHA-1指纹。下面是我如何通过在App目录中运行以下命令来获得它:

Keytool -list -printcert -jarfile app-debug.apk

所以,我基本上在以下应用程序位置运行上述命令:

C:\myApp\platforms\android\app\build\outputs\apk\debug>keytool -list -printcert -jarfile app-debug.apk

这给了我SHA1指纹为:7B:6B:AD:…

希望这能帮助到一些人!

其他回答

#进入cacerts或jsk所在路径,打开并在cmd下运行以下命令

Keytool -v -list -keystore cacerts

Keytool -v -list -keystore .jks

只需在Windows命令提示符中输入这些。

cd C:\Program Files\Java\jdk1.7.0_09\bin

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName\.android\debug.keystore" -list -v

基本密码为android

您将看到MD5、SHA1和SHA256密钥;选择一个你需要的。

keytool是JDK的一部分。

尝试将%{JAVA_HOME}\前置到exec语句或c:\{jdk}的路径\bin。

JDK自带keytool。如果您正在使用cygwin,那么这可能已经在您的路径上了。否则,您可能会在JDK的bin文件夹中查找。

为了使shell管道(|)正常工作,您可能需要使用cygwin。

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