[android] Android Facebook integration with invalid key hash

Paste the following code into your OnCreate method:

try {
    PackageInfo info = getPackageManager().getPackageInfo(
                           "com.example.packagename",
                           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) {
    e.printStackTrace();
}
catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
}

Just modify the package name. Then go to your LogCat file and select Debug search here. Then you will find the hash key. Now copy this hash key and then go to the developer.facebook.app_id site, edit your hash key, and press Save. Now run your Android project again. I think issue will be resolved.