Facebook的SDK为Android - 示例应用程序将无法正常工作示例、无法正常、应用程序、工作

2023-09-04 08:25:02 作者:天会亮心会暖

欧凯,我已经做了所有的企业,所有的步骤,但仍无法得到它的工作。 简单的示例应用程序自带的Facebook的SDK,正在对仿真器和采用Android 1.5的设备。 所以我的猜测是单点登录的事情。

Okey, I've done all the business, followed all the steps, but still can't get it to work. The simple Example app that comes with the Facebook SDK, is working on the emulator and on devices with android 1.5. So my guess is the single login thing.

如果我是正确的话,我应该生成一个密钥散列,我一直在说,正确的调试密钥库放置在

If I'm right then I should generate a key hash and I've been told that the right debug keystore is placed under

C:\ Users \用户xxx.android \ debug.keystore

C:\Users\xxx.android\debug.keystore

所以我也跟着教程。

这是谷歌code和终端我喜欢写东西下载OpenSSL的:

Downloaded OpenSSL from google.code and in the terminal I write something like:

C:\ Program Files文件\的Java \ jdk1.6.0_22 \斌\ keytool.exe的-exportcert -alias   androiddebugkey -keystore   C:\ Users \用户JoeZ.android \ debug.keystore|C:\用户\ XXX \下载\ OpenSSL的-0.9.8k_X64 \ BIN \ openssl.exe   SHA1   -binary |C:\用户\ XXX \下载\ OpenSSL的-0.9.8k_X64 \ BIN \ openssl.exe的base64

"C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe" -exportcert -alias androiddebugkey -keystore "C:\Users\JoeZ.android\debug.keystore"|"C:\Users\xxx\Downloads\openssl-0.9.8k_X64\bin\openssl.exe" sha1 -binary|"C:\Users\xxx\Downloads\openssl-0.9.8k_X64\bin\openssl.exe" base64

和我得到的,我插入了Facebook在Android密钥散列中一个不错的钥匙,我都试过带或不带=输出后的迹象,但似乎没有任何工作。

and I get a nice key which I inserted into the Android Key Hash box in facebook, I've tried both with or without the = sign after the output but nothing seems to work.

我只是得到invalid_key当我尝试登录到示例应用程序。 我甚至尝试了签名的应用程序,但没有奏效。 如果我没有记错在示例应用程序中编写的唯一的事情就是我的APP_ID,对吧?

I just get invalid_key when I try to sign into the Example application. I even tried a signed application but it did not work. And if I'm not mistaken the only thing to write in the Example application is my APP_ID, right?

我有完全相同的问题,我自己的应用程序,我开发。所以请任何人可以帮助我吗?

I'm having the exact same problem with my own application that I'm developing. So please can anybody help me?

推荐答案

如果keytool命令不会为你工作,我发现了一个倒过来的东西:你可以反向将作为密钥散列在其中骨干工程师Facebook开发部分。在你的活动只是做打印出来的密钥散列:

If the keytool command doesn't work for you, I found a way around that stuff: you can just reverse engineer which key to put as Key Hash in the Facebook Developer section. Within your Activity just print out the Key Hash by doing:

try {
   PackageInfo info = getPackageManager().getPackageInfo("[your package name, e.g. com.yourcompany.yourapp]", PackageManager.GET_SIGNATURES);
   for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("Hash Key:", Base64.encode(md.digest()));
   }
} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}

这为我工作。 MessageDigest类是包含在JDK中。 Base64编码类没有。您可以使用这个例如。

This worked for me. The MessageDigest class is included in the JDK. The Base64 class not. You can use this one for example.

 
精彩推荐
图片推荐