我试图利用Facebook的Android SDK开发与Facebook的登录按钮一个简单的应用程序。 但我有带钥匙哈希麻烦。我创建了两个调试键和释放键:
I'm trying to use Facebook Android SDK to develop a simple app with the Facebook Login Button. But i'm having trouble with Key Hashes. I've created both a debug key and a release key:
调试键:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
释放键:
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
然后我复制了Facebook的开发者页面这关键的哈希值。 当我出口的apk文件,并将其复制到它运作良好的设备,但是当我尝试安装Eclipse中的应用程序(如/调试的Android应用程序运行),这是行不通的。看来这个应用程序是使用来自一个我所用密钥工具创建一个不同的密钥散列。 任何人都知道如何解决这个问题呢?
And then i copied this key hashes in the Facebook Developers page. When i export the apk and copy it into the device it works well, but when i try to install the app from Eclipse (run as/debug as Android Application) it doesn't work. It seems that the app is using a different key hash from the one i've created with keytool. Anyone knows how to solve this problem?
尝试从这里得到HashKey
Try to get the HashKey from here
public static void showHashKey(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
"com.example.tryitonjewelry", PackageManager.GET_SIGNATURES); //Your package name here
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}