Facebook sdk 3.0 android

后端 未结 3 1704
走了就别回头了
走了就别回头了 2021-01-07 08:46

I have gone through the tutorials on developer.facebook.com for basic hello world facebook app for android countless times to make sure im not making a mistake but I get the

相关标签:
3条回答
  • 2021-01-07 09:29

    SOLVED.

    The hash value was wrong. It seems to be a windows problem or failure on human end. I used:

    "location of keytool.exe" -exportcert -alias alias -keystore "location of keystore" | "location of openssl.exe" sha1 -binary | "location of openssl.exe" base64

    and got the wrong hash value. Anyways found this post

    http://p-xr.com/implementing-facebook-into-your-app-invalid-key-with-keytool/

    downloaded and ran the keygeneration application and got the hash value out of the logcat. This is great for debug key but unsure about when releasing your program out into the wild

    Hope this helps

    0 讨论(0)
  • 2021-01-07 09:44

    try

    try {
    PackageInfo info = getPackageManager().getPackageInfo("com.eatapp", PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.e("MY KEY HASH:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
    } catch (NameNotFoundException e) {
    
    } catch (NoSuchAlgorithmException e) {
    
    }
    

    in your main Activity :-) This is the only solution it works for me for Android SDK 3.0

    0 讨论(0)
  • 2021-01-07 09:48

    Another possible error (which happened to me) is: to set up a "Key Hash" at Facebook App Console and to sign the android app using another keystore.

    Unfortunately this is caused because Facebook Getting Started Tutorial induces this error. It says that android developers should use default android debug key in your examples and doesn't explain that the Key Hash should be generated with the same keystore you will sign your application.

    My recomendation is to set up two Key Hashes at your facebook console:

    1. default android debug key:

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

    1. your application release key:

    keytool -exportcert -alias yourappreleasekeyalias -keystore ~/.your/path/release.keystore | openssl sha1 -binary | openssl base64

    Remember: you cannot publish an application that is signed with the debug key generated by the SDK tools. So it isn't possible to publish an app using only the hash key generated using the first previous command line (as facebook tutorial suggests.

    For more information about signing your application, visit Signing Your Application.

    0 讨论(0)
提交回复
热议问题