I'm developing an Android application that uses Facebook Authentication. In debug mode, i use the debug key hash generated by the code:
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.org.package", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String sign = Base64
.encodeToString(md.digest(), Base64.DEFAULT);
Log.e("MY KEY HASH:", sign);
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Now I want to publish my app in Google play store, so i need to generate a release key hash. I used the method mentioned in facebook developers doc which is:
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
For the RELEASE_KEY_PATH it's the path of kaystore generated when exporting project to apk.
I added the hey hash generated to facebook app but i still have the error:
invalid key hash. the key hash does not match any stored key hashes facebook android.
When i add the hey hash generated by java code it works, but i can't do it for each device, i need to publish my app so that every one can use it.
What is the solution? Please help me.