0

I am working on Fb Sdk in android. I am doing import fb sdk and sample following here and i also get keyhash like this

 C:\Program Files (x86)\Java\jre7\bin> keytool -exportcert -alias androiddebugkey
 -keystore C:\Users\Duygu\.android\debug.keystore |C:\Users\Duygu\openssl-0.9.8k
_X64\bin\openssl.exe sha1 -binary | C:\Users\Duygu\openssl-0.9.8k_X64\bin\openss
l.exe base64

this is my app register enter image description here

When i run HelloFacebookSampleActivity i am getting this error keyhash problem and changed with my app id from default id after error i am getting same error.

I have some question:

1) When i try HelloFacebookSampleActivity i must change default app id from my id or not?

2)I am using my key hash but i also see reliase key. I must use reliase key now or my keyhash.I am doing just sample now.

3)I dont understand RELEASE_KEY_ALIAS and path.Where is there in my computer?

keytool -exportcert -alias **<RELEASE_KEY_ALIAS>** -keystore **<RELEASE_KEY_PATH**> | openssl sha1 -binary | openssl base64

Can anybody help me? I see all post but i couldnt.

DuyguK
  • 4,250
  • 9
  • 33
  • 46

2 Answers2

1

There is some problem in the way you obtain your hash, I get it like this, and it never fails:

try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.josh.myapp", 
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("joshtag", "KeyHash:"+Base64.encodeToString(md.digest(), Base64.DEFAULT));                              
                } 
            } 
        catch (NameNotFoundException e) { } 
        catch (NoSuchAlgorithmException e) { }   
Josh
  • 6,251
  • 2
  • 46
  • 73
0

In order to run the sample apps that ship with the SDK, you need to add your key hash(es) to your developer settings:

https://developers.facebook.com/settings/developer/sample-app/

Ming Li
  • 15,672
  • 3
  • 37
  • 35
  • Hi Ming can we also change in facebook default app id from values/string.xml? – DuyguK Jan 07 '14 at 18:40
  • Sure, then you'll be using your own app configuration. For Hello Facebook that shouldn't be an issue, for an app like Scrumptious, it may cause problems because the OG stories and namespace will need to change as well. – Ming Li Jan 07 '14 at 18:51