请使用下面的代码生成哈希键
(使用函数)
:
public static void printHashKey(Context pContext) {
try {
PackageInfo info = pContext.getPackageManager().getPackageInfo(pContext.getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String hashKey = new String(Base64.encode(md.digest(), 0));
Log.i(TAG, "printHashKey() Hash Key: " + hashKey);
}
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "printHashKey()", e);
} catch (Exception e) {
Log.e(TAG, "printHashKey()", e);
}
}
生成此散列密钥后,将此密钥添加到facebook控制台。
之后你就可以访问facebook了。
使用命令
对于释放密钥,请执行以下步骤:
(仅适用于Windows用户):
Run the following command in a command prompt in the Java SDK folder:
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | PATH_TO_OPENSSL_LIBRARY\bin\openssl sha1 -binary | PATH_TO_OPENSSL_LIBRARY\bin\openssl base64
使用此命令并下载SSL
Use this link
(仅限MAC用户:)
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64