My app uses facebook api for user login. On developing it works fine, but when I uploaded it to google play it stops working.
This is the error log:
You followed the steps that facebook provides for the creation of a login application?
You need a 'Production keyhash' obtained starting your release keystore:
From comand line:
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
And add this key on facebook app page options.
More information: Facebook docs
This was giving the wrong key for me.
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
A workaround that worked for me was: 1. Put this code in your launching activity
private void printKeyHash(){
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo(
"YOUR_PACKAGE_NAME",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
Log.d("KeyHash:", e.toString());
} catch (NoSuchAlgorithmException e) {
Log.d("KeyHash:", e.toString());
}
}
Hope this helps someone.